Xn+1=Xn-f(Xn)/g(Xn) for n-1,2,3,...where g(Xn)=f(Xn+f(Xn))-f(Xn)/f(Xn). This iterative procedure must stop when the absolute difference between Xn and Xn+1 is less than a given tolerance epsilon. The funtion must accept as inputs a scalar function f, an initial number 'x' and a positive number epsilon to terminate the procedure. Hence use this numerical technique to find the root of the equation e^x-x^2=0.
HELP PLEASE 🙁
syms xf=exp(x)-x^2;y(1)=1;if x(n)-x(n+1)<0.25;for n=0:1:inf;x(k+1)=yk-subs(f,x,yk)/subs(g(xn),x,yk);where g(xn)=(f(xn+f(xn))-f(xn))/(f(xn))endend
Best Answer