(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

The solution of the nonlinear equation x^5-P=0 gives the fifth root of the number

P. A numerical solution of the equation can be calculated with Newton’s

method. The solution process starts by choosing a value x1 as a first estimate of

the solution. Using this value, a second, more accurate solution x2 can be calculated

with x2=x1-((x1^5-P)/(5*x1^4)) , which is then used for calculating a third, still more

accurate solution x3, and so on. The general equation for calculating the value of

the solution xi+1 from the solution x1 is xi+1 = xi -((xi^5-P)/(5*xi^4)) . Write a userdefined

function that calculates the fifth root of a number. For function name and

arguments use y=fifthroot(P), where the input argument P is the number

whose fifth root is to be determined, and the output argument y is the value (5th sqrt(P)) .

In the program use x=P for the first estimate of the solution. Then, by using the

general equation in a loop, calculate new, more accurate solutions. Stop the looping

when the estimated relative error E defined by is smaller than

0.00001.

2. Relevant equations

3. The attempt at a solution

This was my previous attempt. I am not sure whether a for loop or a while loop is the best to use for this situation. My problem is trying to use a previous answer in computing the next answer. Not quite sure how to retain a previous answer for using in the next one.Code (Text):function [y] = fifthroot(P)

format short

x=P;

xi=1;

i=5;

while n==1:i

xi=xi-((xi^5-P)/(5*xi)^4);

E=abs((xi-x)/x);

if E<0.00001

break

end

disp(x)

end

1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: MATLAB: Finding the 5th Root using Newton's Method

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**