Site hosted by Angelfire.com: Build your free website today!

Calculating limits

(Back)
Email the author:Paolo Bonzini


These programs calculate the limit of the value of a function stored in Y1 (there are two separate programs, one for finite and one for infinite values of x). The only strange request is the one for finite limits: "1=>L 2=>R 3=>LR", which means "type 1 to get the limit for x->x0-, type 2 to get the limit for x->x0+, type 3 to get the limit for both x->x0- and x->x0+".

After you give the necessary information, keep pressing Enter to get better approximations. It is normal to get calculation errors, because sometimes huge numbers are involved. Don't panic, just quit and accept the last value given by the program. The program is quite smart but it isn't perfect, for example it does not realize that lim x->+oo ln x is +oo, instead it gives values that keep increasing until the final calculation error. It is up to you to give a meaning to the values given by the program

Finite values:

Print "1=>L 2=R 3=>LR"
Input T
Input X
X=>W
.01=>A
If T=1 Goto LEFT1
W+A=>X
Y1=>B
If T=2 Goto RIGHT
Label LEFT1
W-A=>X
Y1=>C
Goto LEFT

Label LOOP
Wait
.01A=>A

Label LEFT
ClrT
If T=2 Goto RIGHT
W-A=>X
B=>O
Y1=>N
N=>B
Print "LEFT"
Gosub DISP
Label RIGHT
If T=1 Goto LOOP
W+A=>X
C=>O
Y1=>N
N=>C
Print "RIGHT"
Gosub DISP
Goto LOOP

Label DISP
If abs(N-O)>abs(O) Goto INF
Print N
Return
Label INF
If N<0 Goto LESS0
Print "               +OO"
Return
Label LESS0
Print "               -OO"
Return



Infinite values:

Print "1=>-OO 2=+OO 3=>BOTH"
Input T
10=>A
If T=1 Goto MINUS1
A=>X
Y1=>P
If T=2 Goto PLUS
Label MINUS1
-A=>X
Y1=>M
Goto PLUS

Label LOOP
Wait
20A=>A

Label PLUS
ClrT
If T=1 Goto MINUS
A=>X
P=>O
Y1=>N
N=>P
Print "+OO"
Gosub DISP
Label MINUS
If T=1 Goto LOOP
-A=>X
M=>O
Y1=>N
N=>M
Print "-OO"
Gosub DISP
Goto LOOP

Label DISP
If abs(N-O)>abs(O) Goto INF
Print N
Return
Label INF
If N<0 Goto LESS0
Print "               +OO"
Return
Label LESS0
Print "               -OO"
Return