From: Sinan Kapçak on
i want to find the value of the limit

1+(2/(3+(4/(5+(6/(7+...

how can i do that with Mathematica?

Tnx..

From: Daniel Lichtblau on
David W. Cantrell wrote:
> =?UTF-8?Q?Sinan_Kap=C3=A7ak?= <sinankapcak(a)yahoo.com> wrote:
>
>>i want to find the value of the limit
>>
>>1+(2/(3+(4/(5+(6/(7+...
>>
>>how can i do that with Mathematica?
>
>
> I would also be interested to see that done in Mathematica.
>
> BTW, the desired value seems to be (Sqrt[E] + 1)/(E - 1).
>
> David


I should point out that, unlike, say, Euler, I am not able to find this
without Mathematica. Here is one derivation.

I'll start with a finite approximation so we can check the value later.

g[n_] := 1 + Fold[#2[[1]]/(#2[[2]]+#1)&, 1,
Reverse[Partition[Range[2,2*n],2]]]

The value of interest, should we be able to find it, is g[Infinity].

In[2]:= N[g[100],100]
Out[2]=
1.5414940825367982841311034444725146383404592368418821094741369566375\
426391433148070718257240850077422

To find the exact value we define

f[n_] := (2*n)/((2*n+1) + f[n+1])

In this formulation it is 1+f[1] that we want to compute. We will start
with f[Infinity] and work backwards, so to speak. The limiting value,
provided it exists (not hard to show it does), is found as below.

In[5]:= InputForm[sol = Solve[((2*n+1)+finf)*finf==2*n, finf]]
Out[5]//InputForm=
{{finf -> (-1 - 2*n - Sqrt[1 + 12*n + 4*n^2])/2},
{finf -> (-1 - 2*n + Sqrt[1 + 12*n + 4*n^2])/2}}

In[6]:= Limit[finf /. sol, n->Infinity]
Out[6]= {-Infinity, 1}

Well, it's not negative, let alone infinite, so the limiting value is 1.
Now we'll solve the recurrence for f[n] noting that the limiting value is 1.

soln = First[
RSolve[((2*n+1)+f[n+1]) * f[n] - 2*n == 0, f[n], n]];

In[9]:= InputForm[fn = f[n] /. soln]
Out[9]//InputForm=
(-2*Sqrt[E]*n*Gamma[n]*Gamma[1 + n] +
C[1]*Gamma[1 + n]*Gamma[-1 + n, -1/2] -
n*C[1]*Gamma[1 + n]*Gamma[-1 + n, -1/2] +
n*C[1]*Gamma[n]*Gamma[n, -1/2] -
2*n^2*C[1]*Gamma[n]*Gamma[n, -1/2])/
(Gamma[n]*(Sqrt[E]*Gamma[1 + n] + n*C[1]*Gamma[n, -1/2]))

We now need to find C[1]. We use the fact that the limiting value of f
as n->Infinity is finite (so we did not really need to know it is 1). We
start by finding a low order series approximation and look carefully at
it to deduce the circumstances under which it will be finite.

ser = Series[fn, {n,Infinity,1}, Assumptions->n>2^10];

In[11]:= InputForm[nser = Together[Simplify[
Normal[ser], Assumptions->n>2^10]]]
Out[11]//InputForm=
(-2*Sqrt[n]*(2^(1/2 + n)*n^(1/2 + n)*Sqrt[E*Pi] +
3*2^(5/2 + n)*n^(3/2 + n)*Sqrt[E*Pi] -
6*(-1)^n*E^(1/2 + n)*C[1] -
3*2^(3/2 + n)*n^(1/2 + n)*Sqrt[Pi]*C[1] +
3*2^(5/2 + n)*n^(3/2 + n)*
Sqrt[Pi]*C[1]))/(2^(1/2 + n)*n^n*Sqrt[E*Pi] +
3*2^(5/2 + n)*n^(1 + n)*Sqrt[E*Pi] -
12*(-1)^n*E^(1/2 + n)*Sqrt[n]*C[1] +
3*2^(5/2 + n)*n^(1 + n)*Sqrt[Pi]*C[1])

This is a bit hard to handle so we'll separate numerator and
denominator, and substitute for exponents in n.

rul = {E^(a_+n)->E^a*en, 2^(a_+n)->2^a*tn, n^(a_+n)->n^a*nn, n^n->nn};
{num,den} = {Numerator[nser],Denominator[nser]} //. rul;

In[14]:= InputForm[num = Collect[num, {nn,en,tn,n}]]
Out[14]//InputForm=
12*(-1)^n*Sqrt[E]*en*Sqrt[n]*C[1] +
nn*tn*(-2*n*(Sqrt[2*E*Pi] - 6*Sqrt[2*Pi]*C[1]) -
2*n^2*(12*Sqrt[2*E*Pi] + 12*Sqrt[2*Pi]*C[1]))

In[15]:= InputForm[den = Collect[den, {nn,en,tn,n}]]
Out[15]//InputForm=
-12*(-1)^n*Sqrt[E]*en*Sqrt[n]*C[1] +
nn*tn*(Sqrt[2*E*Pi] + n*(12*Sqrt[2*E*Pi] + 12*Sqrt[2*Pi]*C[1]))

At this point we can see that the largest term in the numerator involves
n^n*2^n*n^2, while the largest in the denominator involves n^n*2^n*n,
UNLESS C[1] is -Sqrt[E]. Hence for f[Infinity] to exist we require that
C[1] be -Sqrt[E].

[Note 1: an attempt to check this is a bit problematic. Numerically we
can substitute large n into fn /. C[1]->-Sqrt[E] and it will evaluate to
something close to 1. Taking an explicit limit exposes limitations in
Limit (depending on version, either an inability to evaluate it, or an
incorrect infinite result).]

[Note 2: the derivation of C[1] is a bit fishy in general. We are
relying on Series of gammas at infinity to get a series expansion even
though we know the limit computation, which uses Series, is problematic.
Moreover if we sustitute C[1]->-Sqrt[E] into our series we still do not
see convergence although the largest terms are gone. My guess is this
series needs more work. All the same C[1] is in fact -Sqrt[E]. ]

We return to the problem at hand. With the correct value of C[1] we can
now evaluate our function.

In[34]:= InputForm[result = Simplify[1+fn /. {C[1]->-Sqrt[E], n->1}]]
Out[34]//InputForm= (-1 + Sqrt[E])^(-1)

In[35]:= InputForm[N[result,100]]
Out[35]//InputForm=
1.541494082536798284131103444472514638340459236841882109474136956637542639143\
3148070718257240850077422421968336254852`100.

This certainly agrees with g[100] above.

Daniel Lichtblau
Wolfram Research



From: Takamura on
Sinan Kap?ak wrote:

> i want to find the value of the limit
>
> 1+(2/(3+(4/(5+(6/(7+...
>
> how can i do that with Mathematica?
>

(* the first answer were wrong *)

Table[{i, 1 + N[FromContinuedFraction[Table[(j + 1)/j, {j, 2, i, 2}]],
100]}, {i, 450, 500, 10}]
Last[%][[2]]

--
takamura

From: Scout on

"Scout" <Scout(a)nodomain.com>
> "Sinan Kap?ak" <sinankapcak(a)yahoo.com>
>>i want to find the value of the limit
>>
>> 1+(2/(3+(4/(5+(6/(7+...
>>
>> how can i do that with Mathematica?
>>
>> Tnx..
>>
Hi Sinan,
you could try to solve the recurrence equation that defines your continued
fraction:
i.e.
f[x_]:= x+(x+1) / f[x+2];
with x=1.
Also try to solve separately the 2 recurrence equations:
RSolve[{A[k + 1] == (2k - 1) A[k] + 2k A[k - 1], A[0] == 1, A[1] == 1},
A[k], k]

RSolve[{B[k + 1] == (2k - 1) B[k] + 2k B[k - 1], B[0] == 0, B[1] == 1},
B[k], k]

and the limit of their ratio exists and it is the value of the continued
fraction:

Limit[A[n] / B[n] , n->Infinity].

You are now busy little job ;-)

~Scout~

From: Takamura on
Takamura wrote:
> Sinan Kap?ak wrote:
>
>>i want to find the value of the limit
>>
>>1+(2/(3+(4/(5+(6/(7+...
>>
>>how can i do that with Mathematica?
>>
>
> Table[{i, 1 + N[FromContinuedFraction[Table[(j + 1)/j, {j, 2, i, 2}]],
> 100]}, {i, 450, 500, 10}]
> Last[%][[2]]
>

I'm sorry . This answers is wrong

to be so
g[n_] := FromContinuedFraction[Insert[a = 1; Table[a = j/a; (j + 1)/a,
{j, 2, 2n, 2}], 1, 1]]
Table[{i, N[g[i], 100]}, {i, 55, 60}]
Last[%][[2]] - 1/(Sqrt[E] - 1)

0.x 10^-100

this is the same result which ealier send Daniel Lichtblau with function
Fold

--
takamura