Compputing using Newtons Method
Here we define a little function to calculate the newton
approximation:
newton(f,var,start,iterations):=
block([fp:diff(f,var),p:start,numer:true],
for i:1 thru iterations do
p: sublis([var=p],(p-f/fp)),
p);done;
produces
Above Here First
- Compute with 3 iterations starting at x=2, newton(x^3-27,x,2.1,3) returns
Result
- and with 7 iterations newton(x^3-27,x,2.1,7) evaluates to
Result
Also see plotting