I have to write the procedure with iterations of the first step Newton's method in Moore's form in Mathematica8, exactly on this example: GIVEN:
f[x_]:=x*x-8*x+7; inter={5, 9}; eps = 10^(-6);
TO CALCULATE:
x0 := Mean[{5, 9}]; f[x0] ; f'[x_] ; f'[inter]; n0 = x0 - f[x0]/f'[inter]; x1 = IntervalIntersection[inter,n0];
I tried to do it, but it doesn't calculate iterations correctly :
f[x_]:=x*x-8*x+7
inter := Interval[{5, 9}]
x0 := Mean[{5, 9}]
newton[f_,x0,eps_]:=Module[{old,new,iter,step},
old ;
step[old] := IntervalIntersection[inter, x0 - (f[x0])/(f'[inter])];
new = step[old];
iter=0;
While[Abs[old-new]>eps,
old = new;
new = step[old];
iter++];
Print["Iterations = ", iter];
Print["X1 = ", new];
]
newton[f,x0,0.00001]
HELP PLEASE !!!