/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 0.8.7 ] */ /* [wxMaxima: comment start ] Newton's Method for approximating a solution of f(x)=0. After entering your function, initial appropximation, number of iterations, and precision, press Enter. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ /* User input comes first */ f: x^3-8*x^2+7*x-10 $/* Function f(x) */ x0: 1 $/* Initial estimate */ N: 15 $/* Number of iterations */ fpprec: 32 $/* Precision - Number of significant digits used in computations */ /* End of user input */ set_display(ascii)$ fp: diff(f,x,1)$ xn: bfloat(x0)$ print("x", 0, "=", xn)$ for i: 1 thru N do ( xn: bfloat( xn - at(f,x=xn) / at(fp,x=xn) ), print("x", i, "=", xn) ); /* [wxMaxima: input end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$