(71B) Bisection Plus for the HP71B

06112021, 06:37 PM
(This post was last modified: 06252021 04:24 AM by C.Ret.)
Post: #2




RE: (71B) Bisection Plus for the HP71B
Hi,
I really appreciate this algorithm that stay in the inputted range. Today, it serve me a bit seeking for the roots of a bunch of polynomials. I just modify the original program to add two features :
As useall, since I modified and enhance a few the original code, I post here to share for further user . 5 DIM F$[49] 10 INPUT "F(X)=",F$;F$ @ INPUT "[A,B]=";A,B @ INPUT "Tol=","1E8";T @ INPUT "MaxIte=","30";M 12 X=B @ Y2=VAL(F$) @ X=A @ Y1=VAL(F$) @ IF Y1*Y2>0 THEN BEEP @ DISP "Fa & Fb = sign !" @ END 14 FOR N=1 TO M @ P=X @ X=(A+B)/2 @ Y=VAL(F$) @ IF ABS(BA)<T THEN 24 16 IF Y*Y1<0 THEN S=(Y1Y)/(AX) @ I=S*AY1 ELSE S=(Y2Y)/(BX) @ I=S*BY2 18 L=X @ Z=Y @ X=I/S @ Y=VAL(F$) @ IF Y=0 OR ABS(PX)<T THEN 24 20 IF Z*Y<0 THEN A=L @ Y1=Z @ B=X @ Y2=Y ELSE IF Y*Y2<0 THEN A=X @ Y1=Y ELSE B=X @ Y2=Y 22 DISP X @ NEXT N @ BEEP 24 DISP USING '3ZX,"F("K,")="SDE';N,T*(X DIV T),Y @ END Usage:
The program displays intermediate refinement for the guess. Eventually, adjust display speed with DELAY command. This have to be tuned before starting the program. When it converges or after the maximal iteration count, the program displays the root value in the format : 00n F( x.xxxxxxxx ) = ±#E0##. Where: 00n indicate iteration count. x.xxxxxxxx is the root \( x_0 \) rounded to the tolerance. ±#E0## is the sign and amplitude of the residual \( y=F(x_0)\approx 0 \) Another root can be seek for the same function or for a new function, just press [ f ][CONT] or [RUN] to process. All the parameters can be kept or modified as wish... no edition of the program is needed. Step 1: Root of \( f(x)=e^x3x^2 \) in \( \left [\,2\,,\,0\,\right ] \) Code: [RUN] Code:
Code: F(X)=EXP(X)3*X^2 [END LINE] Edited 25.06.2021 for typos and examples reformat 

« Next Oldest  Next Newest »

Messages In This Thread 
(71B) Bisection Plus for the HP71B  Namir  01122014, 05:44 PM
RE: (71B) Bisection Plus for the HP71B  C.Ret  06112021 06:37 PM

User(s) browsing this thread: 1 Guest(s)