'=========================================================================== ' Subject: NEWTON'S ITERATIVE METHOD Date: 11-12-99 (20:11) ' Author: The ABC Programmer Code: QB, QBasic, PDS ' Origin: voxel@edmc.net Packet: ALGOR.ABC '=========================================================================== ' Newton's iterative method for solving square roots of numbers ' by William Yu (11-12-99) e-mail: voxel@edmc.net DEFDBL A-Z CLS NUM = 2348734 '' Find square root of this number DEF FNF (X) FNF = X ^ 2 - NUM END DEF DEF FNDF (X) FNDF = 2 * X END DEF DEF FNNEWTON (X) FNNEWTON = X - FNF(X) / FNDF(X) END DEF X = 1 '' Initial guess DO Y = FNNEWTON(X) IF X = Y THEN EXIT DO X = Y LOOP PRINT "The square root of"; NUM; "is"; X PRINT "Real value is: "; SQR(NUM)