Useing the following procedure I'd like to collect a set of roots in a list of lists, so they can be manipulated and presented in various plot options. Some of which could be very interesting (to me only perhaps).
One option is to create a loop which produces values of newton roots x0 for a given function. For example: f:=x->(x^7)-5
for x from -1 to 1 by 0.05 do
This produces many values...but I have no idea how to remove the warning that the iteration has failed or how to place them in a list of which I described. I think it would be of the form [[x1+iy1],...[xN+iyN]]. I am at some what of a loss! Any help would be greatfully recieved!!!
Thank you in advance!
> newton := proc( f, # the function x0, # the initial guess n, # step count limit tol # error tolerance)
local x, g, k;
g := D(f); # the derivative f’(x)
x := evalf(x0); # initialize the iteration
for k from 1 to n do # loop for newton’s iteration
# Newton’s iteration formula
x[k] := evalf( x[k-1] - f(x[k-1])/g(x[k-1]) );
# exit early if possible, with luck
if abs(x[k]-x[k-1]) < tol then
return "Newton’s iteration fails"