Evaluate f(N)=3√N, N=72, to five decimal places by Newton-Raphson iterative method.
Newton-Raphson method is given as:
"X_{n+1} = X_n -" "\\frac{f(X_n)}{f(X_n)'}"
Therefore,
"f(x) = x^3 - 72" will give "x = 72^{\\frac{1}{3}}"
Hence,
"X_{n+1} = X_n -" "\\frac{ X_n^3 - 72}{3X_n^2}"
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
Leave a comment