HP Forums
(35S) Limit of a function: LIM x→c+ and LIM x→c- - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (35S) Limit of a function: LIM x→c+ and LIM x→c- (/thread-18058.html)



(35S) Limit of a function: LIM x→c+ and LIM x→c- - Roberto Volpi - 02-20-2022 01:48 PM

This short program computes the limit for x approaching to a value, from both the right and the left, of a function previously stored in the Label F with x as unknown.

LINE INSTRUCTION

001 LBL L
002 1 E -9
003 F1?
004 +/-
005 STO +x
006 XEQ F
007 F0?
008 RTN
009 2 E -9
010 STO -x
011 R down
012 XEQ F
013 x<>y
014 RTN

INSTRUCTIONS:

Select Mode RAD in case of trig function;
Input a function with "x" as unknown, EQN or RPN format alike, in LBL F, followed by RTN;
press XEQ L;
input x value;
press R/S.

in a few seconds, you will have the results as follows:

STACK y: Limit from the left
STACK x: Limit from the right

In case it is used as subroutine for longer programs, or you need to use the "FN=" instruction, set flag 0 if you need just the limit from the right, or set flag 1 if you need just the limit from the left.

In case the result is approaching to +∞ or -∞, the result may be represented by a high number, millions or mantissa+exponent.

It could not work for very nasty functions, as the infamous "Lim x→0 of [1/sin^2(x) - 1/x^2]" specifically elaborated by the late Prof. James Stewart in "Lies my Calculator and Computer Told me", but it does a great job most of the times.

Enjoy!