1
$\begingroup$

My understanding of Mathematica is very limited since I just started using it, I would appreciate any feed back or help.

I am trying to find the closed form of a recurrent function with 2 variables:

A[n_,k_] := 1/n*Sum[A[n-i, k-1], {i,1,n}];
A[0,1] :=0;
A[0,k_]:=0;
A[n_, 1] :=1/n;

I tried doing it using RSolve:

RSolve[{
a[n,k] == (1/n)*Sum[a[n-i, k-1], {i,1,n}], 
a[0,1]==0, 
a[0,k] ==0, 
a[n,1]==1/n}, 
a[n,k], {n, k}]

But i just get as a response the RSolve input: http://imgur.com/a/T1TMH

Am I doing the RSolve equation correctly or am I missing something out here?

$\endgroup$
  • 1
    $\begingroup$ Try this again in a fresh kernel; it seems you had old definitions hanging around. $\endgroup$ – J. M. is away Dec 22 '16 at 1:33
  • $\begingroup$ Thanks for you reply! I tried that and now I don't get the recurrsion error. Although when i enter the RSolve, the output I get is the same RSolve formula again. Not the closed form. $\endgroup$ – t0m9er Dec 22 '16 at 9:39
  • $\begingroup$ It means RSolve[] has no idea what to do; sadly, for partial difference equations, this seems to be par for the course. $\endgroup$ – J. M. is away Dec 22 '16 at 12:38
  • $\begingroup$ There goes my hope! Thanks for the help though :) $\endgroup$ – t0m9er Dec 22 '16 at 13:33
1
$\begingroup$

Here is the recursion with seems to work

A[n_][k_] := 
  A[n][k] = If[k > 1, 1/n*Sum[A[n - i][k - 1], {i, 1, n}], 1/n];
A[0][1] := 0;
A[0][k_ /; k > 1] := 0;

I have tried with

A[5][1]
A[100][2]

which gives

1/5

and

360968703235711654233892612988250163157207/\ 6972037522971247716453380893531230355680000

with

A[1000][5]

it's also working --- it gives 0.110791.

You can test or play with your recursion like this :

p = Table[N[A[500][i]], {i, 1, 20}]
q = Table[N[A[i][3]], {i, 1, 20}]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for the help! I tried using the if clause inside the RSolve: imgur.com/a/T1TMH But got the same result. Is that were you were referring to? or am I doing it wrong? $\endgroup$ – t0m9er Dec 22 '16 at 17:03
  • $\begingroup$ Sorry I have seen an error but to be able to correct It I must close my kernel and I cannot do it right now I will come back to this point later. $\endgroup$ – cyrille.piatecki Dec 22 '16 at 17:54
  • $\begingroup$ Thanks a lot! I would really appreciate it! $\endgroup$ – t0m9er Dec 22 '16 at 19:50
  • $\begingroup$ I have corrected the code. It seems to work properly. But it will be advised to test manually for small values. $\endgroup$ – cyrille.piatecki Dec 22 '16 at 21:09
  • $\begingroup$ Hey! Thanks for the corrected code. I can now play with the recursion, but I am looking for a closed form of the equation. You have any idea how to get to the closed from using the formula? I think usually RSolve does it in Mathematica, but it doesn't seem to work for me. $\endgroup$ – t0m9er Dec 22 '16 at 21:25
0
$\begingroup$

It turns out this recurrent function have been researched before. It can be solved by: $$\frac{S(n,k)}{n!}$$ Where $S(n,k)$ is Sterling number of the first kind: https://en.wikipedia.org/wiki/Stirling_numbers_of_the_first_kind The Stirling numbers of the first kind have known generating functions and are much more researched.

@Sil deserves the credit for finding it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.