using Matlab Let fx x2 a Show that the Newtons Method lead
using Matlab
Solution
According to newton\'s formula,
xn+1 = xn - f(x)/f\'(x)
Therefore, xn+1 = xn - (xn2 - a)/2xn
which is, 1/2 * (xn + a/xn)
Hence, proved.
x = 2; %initializing x
a = 2; %choosing a random a
while (x>sqrt(2)+0.0001) || (x<sqrt(2)-0.0001)
x = 0.5*(x+a/x); %recurrence formula
end
disp(x); %displaying x
