Originally Posted by

**CaptainBlack** We want to find

such that

, that is we want roots of

.

Newtons method is the itteration:

So in this case it is:

The Matlab code will look something like:

Code:

function xn=tenthroot(n,x0)
%
% n is the number we want the 10-th root of
% x0 is an initial guess
%
xn=x0;del=100
while del>1e-12
xo=xn;
xn=xo-(xo^10-n)/(10*xo^9);
del=abs(xn-xo);
end %while

This is untested code, so try it first in the debugger or whatever

RonL

Now I don't have Matlab on this machine, but the algorithm can be tested on other systems, so here is the EuMathT version:

Code:

Processing configuration file.
Done.
>
>function tenth(n,x0)
$ xn=x0;del=100;
$ repeat
$ xo=xn;
$ xn=xo-(xo^10-n)/(10*xo^9);
$ del=abs(xn-xo);
$ if del<1e-12
$ break
$ endif
$ end ..repeat
$ return xn
$endfunction
>
>tt=tenth(20,1)
1.34928
>tt^10
20
>

RonL