Message Boards Message Boards

[✓] Is above Wolfram Language syntax for RecurrenceTable wrong?

GROUPS:

Consider the following code:

RecurrenceTable [{d[n] == {1/(n+1)! + Sum[((2^(k*(k-1)/2)/(n-k+1)!)*d[k])/((2^n-1)*2^(n*(n-1)/2)),{k,1,(n-1)}]}, d[0] == 1},d,{n, 0, 200}]

Is above Mathematica syntax wrong?

Answer
21 days ago

There seems to be an extra curly brace pair, but the main problem is that d[n] depends on n in a too complicated way to get a closed solution. However, you don't need RecurrenceTable to compute successive values:

Clear[d];
d[0] = 1;
d[n_] := d[n] = 
   1/(n + 1)! + 
    Sum[((2^(k (k - 1)/2)/(n - k + 1)!) d[
         k])/((2^n - 1) 2^(n (n - 1)/2)), {k, 1, (n - 1)}];
Table[d[n], {n, 1, 10}]
POSTED BY: Gianluca Gorni
Answer
20 days ago

I didn't read the formula. But Mathematica can solve recurrence relatations to some polynomial depth - more than most or any other solvers will do. Obviously getting a few values does not require "a new symbolic equation that is non-recurrent" :)

POSTED BY: John Hendrickson
Answer
17 days ago

FYI - I received the following reply from Wolfram Technical Support

I understand that you are using RecurrenceTable, but you are getting an error with no result. The reason is that the RecurrenceTable does not accept a sum as part of the recurrence equation. For example, consider the following simplified example, which returns the same error:

RecurrenceTable[{d[n]==Sum[d[k],{k,0,(n-1)}], d[0]==1},d,{n,1,10}] 

I was not able to to get this to work directly with RecurrenceTable, but you can get it to work by first constructing a table containing the terms in Sum[d[k],{k,0,(n-1)}] up to some maximum n, then use Table to construct the result you would expect from RecurrenceTable. The code to do this is below:

In[1]:= sumTable = Table[Sum[d[k], {k, 0, (n - 1)}], {n, 1, 10}]
Out[1]= {d[0], d[0] + d[1], d[0] + d[1] + d[2], 
 d[0] + d[1] + d[2] + d[3], d[0] + d[1] + d[2] + d[3] + d[4], 
 d[0] + d[1] + d[2] + d[3] + d[4] + d[5], 
 d[0] + d[1] + d[2] + d[3] + d[4] + d[5] + d[6], 
 d[0] + d[1] + d[2] + d[3] + d[4] + d[5] + d[6] + d[7], 
 d[0] + d[1] + d[2] + d[3] + d[4] + d[5] + d[6] + d[7] + d[8], 
 d[0] + d[1] + d[2] + d[3] + d[4] + d[5] + d[6] + d[7] + d[8] + d[9]}

In[2]:= d[0] = 1;
Table[d[n] = sumTable[[n]], {n, 1, 10}] 
Out[3]= {1, 2, 4, 8, 16, 32, 64, 128, 256, 512}
Answer
15 days ago

Group Abstract Group Abstract