|
!'Muller's Method
INPUT T
LET X1=T
LET X2=(1+T)/2
LET X3=1
DO
LET Q=(X3-X2)/(X2-X1)
LET A=Q*F(X3)-Q*(1+Q)*F(X2)+Q^2*F(X1)
LET B=(2*Q+1)*F(X3)-(1+Q)^2*F(X2)+Q^2*F(X1)
LET C=(1+Q)*F(X3)
LET DD=B^2-4*A*C
IF DD>0 THEN
LET X4=X3-(X3-X2)*2*C/MAX(B+SQR(DD),B-SQR(DD))
ELSE
LET X4=X3-(X3-X2)*2*C/B
END IF
LET X1=X2
LET X2=X3
LET X3=X4
LOOP UNTIL ABS(F(X4))<1E-13
PRINT X4;X4^3
FUNCTION F(X)
LET F=X*X*X-T
END FUNCTION
END
|
|