Re: Newton's method

*To*: mathgroup at smc.vnet.net*Subject*: [mg26314] Re: Newton's method*From*: Clark <clark at brutele.be>*Date*: Sun, 10 Dec 2000 21:38:00 -0500 (EST)*Organization*: Brutele s.c. - 29 Rue de Naples - 1050 Bruxelles - Belgique*References*: <90kpnd$r1n@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

drek wrote: > > Hi all, > I am trying to use the Newton-Raphson method to find the root to an > equation. > The formula looks like this: > > newton[f_, x_, x0_, n_, opts___] := > With[{df = D[f, x]}, FixedPointList[(x - f/df) /. x -> # &, N[x0], n, > opts]] > > with f=Sqrt[x^2 - 2584] * Coth[0.00128 * Sqrt[x^2 - 2584]]+ Sqrt[x^2 - > 1013]. > > When I set > > newton[f, x, 31, 20] > > I end up getting values which do not converge. However, if I were to plot > the function using the Plot function in Mathematica (between x values of 32 > and 51), it seems like the root is somewhere near 33. This is where you're going wrong. Look carefully at where your axes intersect. Mathematica plots the relevant bit of the graph ... choosing an appropriate domain and range. To see what happens more clearly, try forcing the range yourself: Plot[f, {x, 32, 51}, PlotRange -> {0, 820}] with your f. > > I would thus like to know if perhaps there is something wrong with this > formulation for the Newton's method, or that there is some quirk in the Plot > function and the function, f, in fact do not have a root at all. Yes, it's kind of a quirk in Plot. Makes sense when you see it, though. Bob