In short, I want to solve a recurrence equation in two variables with multiple boundary conditions.
In more detail:
For instance, suppose I want to compute
$a[0,j]= 1 \quad \forall j$
$a[i,0]= 1 \quad \forall i$
$a[i,j] = a[i-1,j]+a[i-1,j-1]+a[i,j-1]\quad \forall i,j \geq 1$
My approach:
Clear["Global`*"]
RSolve[{a[i, j] == a[i - 1, j] + a[i - 1, j - 1] + a[i, j - 1], a[0, j] == 1, a[i, 0] == 1}, a[i, j], {i, j}]
Just yields the same expression as output -- without any error message or result:
RSolve[{a[i, j] == a[-1 + i, -1 + j] + a[-1 + i, j] + a[i, -1 + j], a[0, j] == 1, a[i, 0] == 1}, a[i, j], {i, j}]
I presume the error is because I somehow need to encode the case distinction (for $i,j \geq 1$, apply the recursive equation, else the constants), but I could not find any example code in the documentation on how to do this. In general, in the documentation, there is never a case distinction, so mathematica seems to ''find out'' which equation to use.
My attempt to fix this was a piecewise function:
RSolve[a[i, j] == Piecewise[{{a[i - 1, j], i > 0}, {1, i == 0} } ], a[i, j], {i, j}]
But also did not work.
Debugging the code further, I have the weird behaviour that this very basic version of the recurrence equation works:
RSolve[{a[i, j] == a[i - 1, j], a[0, j] == 1}, a[i, j], {i, j}]
{{a[i, j] -> 1}}
but as soon as I add the second base case:
RSolve[{a[i, j] == a[i - 1, j], a[0, j] == 1, a[i, 0] == 1}, a[i, j], {i, j}]
I get again the strange output
RSolve[{a[i, j] == a[-1 + i, j], a[0, j] == 1, a[i, 0] == 1}, a[i, j], {i, j}]
without any error message.
My questions would be:
(1) Does anyone know how to solve this problem?
(2) Going further, if we have another case distinction, e.g. the recurrence would change for $i > 10 $ to $ a[i,j] = 100*a[i-1,j]+ a[i-1,j-1] + a[i,j-1]$, is there a way to encode that case distinction?
RSolve[a[i, j] == a[i - 1, j], a, {i, j}]
results in{{a -> Function[{i, j}, C[1][j]]}}
. One may putC[1][j]=1
. $\endgroup$