I'm trying to construct an iterative procedure al1(f,x0) where f is a function, x0 is an initial estimate.
Now for example by defining f:= x-> 4*x^4-4*x^2 and inputting x0=0.75 and N=10 i should be able to check that my procedure calculates 1 correctly.
f := x -> 4*x^4 - 4*x^2;
f1 := D(f);
f2 := D(f1);
x0 := 0.75;
Digits := 100;
tol := 10.^(-15);
local y, z, s, i, fs, a, de;
s := x0:
for i from 1 to 10
while abs(fs)>tol and de>tol do
y := evalf(s- f(s)/f1(s)):
return n, s, fs, de;
> n, s, fs, de := al1(f, 0.75);
Error, (in al1) cannot determine if this expression is true or false: 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < abs(fs) and 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < de
The code i've written so far is incorrect but i'm not sure where i'm going wrong. Would you be able to give me some pointers?