Mathematica does not evaluate the following recurrence of two variables using RSolve
and only echoes the input:
RSolve[{a[m, n] == a[m, n - 1] + a[m - 1, n - 1] + a[m - 1, n], a[1, n] == 1, a[m, 1] == 1}, a[m, n], {m, n}]
Then, I settle for RecurrenceTable
, and Mathematica does not evaluate it either:
RecurrenceTable[{a[m, n] == a[m, n - 1] + a[m - 1, n - 1] + a[m - 1, n], a[1, n] == 1, a[m, 1] == 1}, a, {m, 1, 3}, {n, 1, 3}] // Grid
Problem: Why does Mathematica not evaluate the recurrence? Maybe Mathematica cannot find the closed form for it using
RSolve
, but why does it not evaluate the recurrence usingRecurrenceTable
either?
My Trials:
If I remove the a[m, n - 1]
part from the recurrence, it works:
RecurrenceTable[{a[m, n] == a[m - 1, n - 1] + a[m - 1, n], a[1, n] == 1, a[m, 1] == 1}, a, {m, 1, 3}, {n, 1, 3}] // Grid
(*
1 1 1
2 2 2
4 4 4
*)
If I leave a[m, n - 1]
and remove any one (or both) of the other two parts from the recurrence, it does not work again.
In document for RecurrenceTable
, there is a similar example:
RecurrenceTable[{s1[n, k] == s1[n - 1, k - 1] - (n - 1) s1[n - 1, k], s1[0, k] == KroneckerDelta[k]}, s1, {n, 0, 6}, {k, 0, 4}] // Grid
So, I just guess that it may be required for the first parameter to be decreased in the recurrence.
Similar Post: This post comes up with the same problem, but it asks for additional ways instead of what is going on here.
a[1, 1]=1
; how would I calculatea[1,2] = a[1, 1]+a[0,1] + a[0, 2]
? $\endgroup$a[1, 2] = 1
according to the initial conditiona[1,n] == 1
. No need to apply the recurrence for it. $\endgroup$