Message Boards Message Boards

0
|
10628 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can I define a sequence from a recurrence?

Posted 9 years ago

I have some trouble with defining a sequence from a recurrence in Wolfram Alpha.

If I type u(n+1) = (2^(u(n)))/(n+1), u(0) = 1, Wolfram seems to understand what I mean, and gives the correct first terms:

n | 0 | 1 | 2 | 3 | 4
u(n) | 1 | 2 | 2 | 1.33333 | 0.629961

However, when I type u(n+1) = (3^(u(n)))/(n+1), u(0) = 1 (the only difference is the 2 being replaced by a 3), then I get totally unexpected results:

n | 0 | 1 | 2 | 3 | 4
u(n) | 0.6 | 0.322197 | 0.20353 | 0.156321 | 0.131929

How can u(0) = 0.6 when I give u(0) = 1? I would have expected to get 1, 3^1/1=3, 3^3/2, etc. in the same way that the first sequence values were 1, 2^1/1 = 2, 2^2/2 = 2, 2^2/3 = 1.33333 etc.

What am I doing wrong, and how to explain the result in the second case?

Thanks!

POSTED BY: Jean F.
2 Replies
Posted 9 years ago

Thank you for your answer... I realize I might have given the wrong tags to my question, it is not a mathematica program, just the input that I give to Wolfram Alpha... ( Sequence with 2 and Sequence with 3 )

Could this overflow that you mention be the reason of the strange output in the second case? Or am I doing a stupid mistake somewhere?

POSTED BY: Jean F.

Please provide your code...but the most likely is that you do not use a SetDelayed (:=) for the definition of u[n] or that you don't Clear u before redefining it.

In[1]:= Clear[u]
u[0] = 1;
u[n_] := (2^u[n - 1])/n

In[4]:= u /@ Range[0, 4] // N

Out[4]= {1., 2., 2., 1.33333, 0.629961}

In[5]:= Clear[u]
u[0] = 1;
u[n_] := (3^u[n - 1])/n

In[8]:= u /@ Range[0, 4]

Out[8]= {1, 3, 27/2, 531441 Sqrt[3], 3^(531441 Sqrt[3])/4}

Please note that the recurrence with a 3 is quickly divergent (overfow at n=5).

In[9]:= u[4] // N

Out[9]= 2.054631331186877*10^439181

In[10]:= u[5] // N

During evaluation of In[10]:= General::ovfl: Overflow occurred in computation. >>

Out[10]= Overflow[]
POSTED BY: Christian Neel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract