Re: newtons method, notation
- To: mathgroup at smc.vnet.net
- Subject: [mg21197] Re: [mg21084] newtons method, notation
- From: BobHanlon at aol.com
- Date: Fri, 17 Dec 1999 01:24:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Newton's method would be written as Clear[x]; x[n_] := x[n] = x[n - 1] - f[x[n - 1]]/f'[x[n - 1]]; This just uses the slope of the curve evaluated at x[n-1] to determine where the straight line intersects the x-axis and uses the intercept as the value of x[n]. Let, f[x_] := 7*x^2 + 3*x - 5; Plot[f[x], {x, -1.5, 1.5}]; x[1] = 2.; Table[x[n], {n, 1, 6}] {2., 1.06452, 0.722348, 0.659848, 0.657614, 0.657611} Clear[x]; x[n_] := x[n] = x[n - 1] - f[x[n - 1]]/f'[x[n - 1]]; x[1] = -2.; Table[x[n], {n, 1, 6}] {-2., -1.32, -1.1109, -1.08652, -1.08618, -1.08618} The Fibonacci sequence is fibTable1 = Table[{n, Fibonacci[n]}, {n, 0, 10}] {{0, 0}, {1, 1}, {2, 1}, {3, 2}, {4, 3}, {5, 5}, {6, 8}, {7, 13}, {8, 21}, {9, 34}, {10, 55}} The recursive definition is a[0] = 0; a[1] = 1; a[n_] := a[n] = a[n - 1] + a[n - 2]; fibTable2 = Table[{n, a[n]}, {n, 0, 10}] {{0, 0}, {1, 1}, {2, 1}, {3, 2}, {4, 3}, {5, 5}, {6, 8}, {7, 13}, {8, 21}, {9, 34}, {10, 55}} fibTable1 == fibTable2 True The closed form of a[n] is expr1 = Simplify[Fibonacci[n] // FunctionExpand, Element[n, Integers]] (-(-(2/(1 + Sqrt[5])))^n + (1/2*(1 + Sqrt[5]))^n)/Sqrt[5] The recursive equation can also be solved by Mathematica Needs["DiscreteMath`RSolve`"] Clear[a]; expr2 = (a[n] /. Flatten[RSolve[{a[n] == a[n - 1] + a[n - 2], a[0] == 0, a[1] == 1}, a[n], n]]) -(((1/2*(1 - Sqrt[5]))^n - (1/2*(1 + Sqrt[5]))^n)/Sqrt[5]) FullSimplify[expr1 == expr2] True Bob Hanlon In a message dated 12/13/1999 1:23:46 AM, aka007 at mail.com writes: >can someone explain a bit the notation for newtons method? >can someone show me the fibonacci sequence on mathematica? > >f(n_):=x(n_)=f(n)/f'(n) > >sorry, i don't exactly recall newtons method, nor the mathematica >to do it. > >and then the second part is creating a table of data, based on inital >guess. graph would be good, too. > >but what in the world is the first part doing??? >