Evaluate f(N)=3√N, N=72, to five decimal places by Newton-Raphson iterative method.
Newton-Raphson method is given as:
Therefore,
will give
Hence,
The above equation has been implemented in MATLAB and the code is given below. The output is show in the attached figure,
close all,
clear all,
clc,
e = 0.00001;
Xn = 0.5;
error = Xn;
r=0;
N=72;
fprintf('\n\tInitial Guess = X0 = %.5f',Xn);
fprintf('\n\tAccuracy = %.5f',e);
while(error>e)
Xn_1 = Xn - (((Xn*Xn*Xn) - N)/(3*Xn*Xn));
error = abs(Xn - Xn_1);
fprintf('\n\tX%d = %.5f\tX%d = %.5f\tError = %.5f',r,Xn,r+1,Xn_1,error);
Xn = Xn_1;
r=r+1;
end
fprintf('\n\n\tFinal Value (%d)^(1/3) = %.5f\n\n',N,Xn);
Comments