Link-
Joined: 14 Nov 2007 Posts: 1
|
Posted: November 14, 2007 8:06 PM Post subject: Bisection Method Programming Problem |
|
|
Hi,
I'm trying to program bisection method for my numerical analysis class, I still having a problem on it for some reason fp and fa are having the same value.
Here's my code
| Code: |
ClrIO
Dialog
Request "Function",f
Request "Initial point",a
Request "Final Point",b
Request "Tolerance",tol
EndDlog
If Ok=0:Stop
expr(a)->a:expr(f)->f:expr(b)->b:expr(tol)->tol
a->x
f->fa
While abs(a-b)/(abs(a+b)/2)>tol
a+(b-a)*0.5->p
p-x
f->fp
If fp=0 Then
Disp "p=",p
Stop
EndIf
If fa*fp>0 Then
p->a
fp->a
Else
p->b
EndIf
EndWhile
Disp "f(p)=0, p=",p
EndPrgm |
By the way, could some recommend me a book for learning TI-Basic programming?
Thanks
Link[/code] |
|