Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Limit of Infinitely Nested Expression (4.0 succeeds, 5.2 fails...)

64 views
Skip to first unread message

dimitris

unread,
Nov 25, 2006, 6:02:43 AM11/25/06
to
$VersionNumber
5.2

Limit[Nest[Sqrt[5 + #1] & , 5, n], n -> Infinity]
Nest::intnm : "Non - negative machine - size integer expected at
position 3 in ` ` ".
Limit[Nest[Sqrt[5 + #1] & , 5, n], n -> Infinity]

$VersionNumber
4.0

Needs["Calculus`Limit`"]

Limit[Nest[Sqrt[5 + #]&, 5, n], n -> Infinity]
(1/2)*(1 + Sqrt[21])
N[%]
2.79129

(*Check*)

Table[N[Nest[Sqrt[5 + #1] & , 5, n], 20], {n, 2, 10}]
{2.8569700138728056542,2.8030287215568815242,2.7933901842665806726,2.\
7916644111115112098,2.7913553000489764255,2.7912999301488502752,2.\
7912900118312411350,2.7912882351758732577,2.7912879169257823550}

$VersionNumber
5.2

Needs["Calculus`Limit`"]
Limit::obslt: Functionality previously provided by Limit.m is
superseded by the kernel Limit function. The package Calculus`Limit` is
obsolete.

bobba...@frii.com

unread,
Nov 26, 2006, 4:24:55 AM11/26/06
to
I contacted Wolfram tech support about this bug. They replied that 4.0
was in error, and that 5.2 is working as it should. (!) I don't buy
their argument. I think they should fix it, to make it possible to
compute the exact limit in this case. Nevertheless, here is their
reply:

I believe that Mathematica is behaving correctly in
this example.

Nest and NestList allow you to apply functions a fixed number of times.
In
this sense, the behavior of Ver. 5.X is correct while the behavior of
the
package "Limit" for Ver. 4 is inappropriate.

Often you may want to apply functions until the result no longer
changes.
You can do this using FixedPoint.

In[2]:=
FixedPoint[N[Sqrt[5 + #1] &, 40], N[5, 40]]

Out[2]=
2.791287847477920003294023596864004244492

Note that, the following won't terminate.

In[3]:=
FixedPoint[Sqrt[5 + #1] &, 5]

Out[3]=
$Aborted

because "SameTest" is done symbolically. You may do

In[4]:=
FixedPoint[Sqrt[5 + #1] &, 5.0000000000000000]

Out[4]=
2.791287

though it will take a lot more time if you add more "0"'s to the right
of

5.0000000000000000

This is again because of symbolic "SameTest."

If you do want to symbolically compute the fixed point of the function,
then, as you pointed out, you have to manually solve the equation:

In[5]:=
Solve[x == Sqrt[5 + x]]

Out[5]=
1 + Sqrt[21]
{{x -> ------------}}
2

da...@wolfram.com

unread,
Nov 27, 2006, 4:26:41 AM11/27/06
to


I have done work on Limit over the past few years so I can comment from
that perspective. While I might have worded the response a bit
differently, I side with Tech Support on this. Let me give a few reasons.

Limit is designed to work on functions defined on a continuum, and known
in a closed form. The function in question satisfies neither requirement.
While it might be possible to find a closed form function that agrees with
it at integers, it is not something that will be done automatically
(indeed, such a function might or might not be what was "intended"). I'll
note that when I tried I was not able to get such a function for this
example using RSolve.

It is true that the Calculus`Limit code had some tricks built in for
handling examples such as this. Neat. (Or, if you are of the right age and
from the English-speaking world, groovy). What it did not have was
consistency or maintainability. The decision to scrap it was not exactly a
difficult call; it was riddled with bugs and simply not fixable.

Bottom line is that the Limit function was not designed or intended to
handle functions defined on only a sequence of points, or to handle
functions not given in explicit closed form. The Calculus`Limit function
had limited (if you will) capabilities in this respect. It is correct to
say that this particular aspect of the package function was not taken on
by the built-in Limit. For examples such as this one gets results exactly
as indicated in the TS response: use Solve to find an exact representation
of the fixed point for the iteration.


Daniel Lichtblau
Wolfram Research

Peter Pein

unread,
Nov 27, 2006, 4:39:10 AM11/27/06
to
dimitris schrieb:
...

> $VersionNumber
> 5.2
>
> Needs["Calculus`Limit`"]
> Limit::obslt: Functionality previously provided by Limit.m is
> superseded by the kernel Limit function. The package Calculus`Limit` is
> obsolete.
>

Hi Dimitris,

if you've got the old Limit.m somewhere on your disks, you can Get[] it:

In[1]:=
$VersionNumber
Out[1]=
5.1
In[2]:=


Limit[Nest[Sqrt[5 + #1] & , 5, n], n -> Infinity]

Nest::intnm: ....
Out[2]=


Limit[Nest[Sqrt[5 + #1] & , 5, n], n -> Infinity]

In[3]:=
Get["D:\\Programme\\Wolfram \
Research\\Mathematica\\4.0\\Addons\\StandardPackages\\Calculus\\Limit.m"]
In[4]:=


Limit[Nest[Sqrt[5 + #1] & , 5, n], n -> Infinity]

Out[4]=


(1/2)*(1 + Sqrt[21])

dimitris

unread,
Nov 27, 2006, 4:56:21 AM11/27/06
to
For anyone cares have adopted this limit for the Mathematica Guidebook

for Symbolics of M. Trott where it is used version 4.0.

Dimitris

bobba...@frii.com

unread,
Nov 28, 2006, 6:13:42 AM11/28/06
to
da...@wolfram.com wrote:
> For examples such as this one gets results exactly
> as indicated in the TS response: use Solve to find an exact representation
> of the fixed point for the iteration.
>
>
> Daniel Lichtblau
> Wolfram Research

Yes, you can use Solve[x == Sqrt[5 + x]] to get the exact solution to
this particular problem.

But how is the user supposed to know what equation to solve?

It is unfortunate that Mathematica is unable to give an exact solution
to the limit of expressions like:

Sqrt[10]
Sqrt[5+Sqrt[10]]
Sqrt[5+ Sqrt[5+Sqrt[10]]]
...

dimitris

unread,
Nov 28, 2006, 6:30:57 AM11/28/06
to
Dear Daniel,

Thanks a lot for yor response.
Your explanation is clear. I got the point!

I really appreciate your assistance

Best Regards
Dimitris

P.S. Thanks also to everyone else that replied me.

Andrzej Kozlowski

unread,
Nov 29, 2006, 2:59:43 AM11/29/06
to math...@smc.vnet.net
The user should learn some (fairly elementary) mathematics.
The limit of a nested expression of the form: Nest[f,...], if it
exists, is a fixed point of the function f. A fixed point of f is a
root of f[x]-x==0.

Andrzej Kozlowski

Tokyo, Japan

On 28 Nov 2006, at 20:03, bobba...@frii.com wrote:

da...@wolfram.com wrote:
For examples such as this one gets results exactly
as indicated in the TS response: use Solve to find an exact representation
of the fixed point for the iteration.


Daniel Lichtblau
Wolfram Research

Yes, you can use Solve[x == Sqrt[5 + x]] to get the exact solution to

0 new messages