Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One numerical method for calculating the cubic root of a number, P3 is in iterat

ID: 3011386 • Letter: O

Question

One numerical method for calculating the cubic root of a number, P3 is in iterations.The process starts by choosing a value x1 as a first estimate of the solution. Using this value, a second, more accurate value x2 can be calculated with x2 = (P/x12 + 2x1)/3 which is then used for calculating a third, still more accurate value x3, and so on. The general equation for calculating the value of xi+1 from the value of xi is xi+1 = (P/xi2 + 2xi)/3. Write a MATLAB program that calculates the cubic root of a number. In the program use x1 = P for the first estimate of the solution. Then, by using the general equation in a loop, calculate new, more accurate values. Stop the looping when the estimated relative error E is smaller than 0.00001

E=|xi+1xixi|

Use the program to calculate:

1003

537013

19.353

Explanation / Answer

function guess = my_cube_root(a)

% Function computes the cube_root of a number using the newton raphson

% method where the nth root of any number is given by successive

% approximations of % of x_k+1 = (1/n)*[(n-1)*x_k + a/((x_k^(n-1))]

% for the cube root this approximation would be x_k+1 = (1/3)[2*x_k + A/(x^2)]

guess = a/3;

epsilon = 1.0e-6;

delta = guess^3 - a;

while(abs(delta) > epsilon)

    guess = (1/3)*(2*guess + (a/guess^2));

    delta = guess^3 - a;

    fprintf('Cube root guess : %f Actual cube : %f Estimated cube: %f ',guess,a,guess^3);

end

end

a =100 ,   4.6416

a = 53701 37.7277

a= 19.35 2.6847

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote