Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

I have implemented Newton's Method, and I am trying to find the exact value of the zero of a polynomial using Limit. The dream is that the following code works:

g[x_] := 21 - 3 x - 7 x^2 + x^3;
newtonNextGuess[f_, guess_] := guess - f[guess]/f'[guess];
Limit[Nest[newtonNextGuess[g, #] &, 1, n], n -> Infinity]

But this returns an error:

Nest: Non-negative machine-sized integer expected at position 3 in
    Nest[newtonNextGuess[g,#1]&,1,n].

The error persists if I make n an integer by replacing it with 1+Ceiling@Abs@n as talked about in this postthis post. So the small question is: why is this error happening? But more importantly, is there way I can get Mathematica to tell me the limit of this sequence? The limit is $\sqrt{3}$, and it would be really nice to get Mathematica to display this explicitly (as opposed to numerically) for a presentation.

I have implemented Newton's Method, and I am trying to find the exact value of the zero of a polynomial using Limit. The dream is that the following code works:

g[x_] := 21 - 3 x - 7 x^2 + x^3;
newtonNextGuess[f_, guess_] := guess - f[guess]/f'[guess];
Limit[Nest[newtonNextGuess[g, #] &, 1, n], n -> Infinity]

But this returns an error:

Nest: Non-negative machine-sized integer expected at position 3 in
    Nest[newtonNextGuess[g,#1]&,1,n].

The error persists if I make n an integer by replacing it with 1+Ceiling@Abs@n as talked about in this post. So the small question is: why is this error happening? But more importantly, is there way I can get Mathematica to tell me the limit of this sequence? The limit is $\sqrt{3}$, and it would be really nice to get Mathematica to display this explicitly (as opposed to numerically) for a presentation.

I have implemented Newton's Method, and I am trying to find the exact value of the zero of a polynomial using Limit. The dream is that the following code works:

g[x_] := 21 - 3 x - 7 x^2 + x^3;
newtonNextGuess[f_, guess_] := guess - f[guess]/f'[guess];
Limit[Nest[newtonNextGuess[g, #] &, 1, n], n -> Infinity]

But this returns an error:

Nest: Non-negative machine-sized integer expected at position 3 in
    Nest[newtonNextGuess[g,#1]&,1,n].

The error persists if I make n an integer by replacing it with 1+Ceiling@Abs@n as talked about in this post. So the small question is: why is this error happening? But more importantly, is there way I can get Mathematica to tell me the limit of this sequence? The limit is $\sqrt{3}$, and it would be really nice to get Mathematica to display this explicitly (as opposed to numerically) for a presentation.

Tweeted twitter.com/StackMma/status/838295453615734784
Source Link
Mike Pierce
  • 593
  • 5
  • 15

Limit of an Expression Created with Nest

I have implemented Newton's Method, and I am trying to find the exact value of the zero of a polynomial using Limit. The dream is that the following code works:

g[x_] := 21 - 3 x - 7 x^2 + x^3;
newtonNextGuess[f_, guess_] := guess - f[guess]/f'[guess];
Limit[Nest[newtonNextGuess[g, #] &, 1, n], n -> Infinity]

But this returns an error:

Nest: Non-negative machine-sized integer expected at position 3 in
    Nest[newtonNextGuess[g,#1]&,1,n].

The error persists if I make n an integer by replacing it with 1+Ceiling@Abs@n as talked about in this post. So the small question is: why is this error happening? But more importantly, is there way I can get Mathematica to tell me the limit of this sequence? The limit is $\sqrt{3}$, and it would be really nice to get Mathematica to display this explicitly (as opposed to numerically) for a presentation.