How to solve for the analytical solution of the recurrence relation in mathematics

I have a repetition like the following:

RSolve[{f[m, n] == f[m, n - 1] + f[m - 1, n], 
        f[0, n] == 1, f[m, 0] == 1}, 
        f[m, n], {n}]

I tried using RSolve but got an error:

RSolve::deqx: Supplied equations are not difference equations 
              of the given functions.

Appreciate your help!

+3
source share
2 answers

Difference equation and initial conditions difference equation

Mathematics (7 and 8) does not like to solve it ... both with the initial conditions and without them. RSolve expressions are not evaluated

In[1]:= RSolve[{f[m,n]==f[m,n-1]+f[m-1,n],f[0,n]==f[m,0]==1},f[m,n],{m,n}]
        RSolve[{f[m,n]==f[m,n-1]+f[m-1,n]},f[m,n],{m,n}]
Out[1]= RSolve[{f[m,n]==f[-1+m,n]+f[m,-1+n],f[0,n]==f[m,0]==1},f[m,n],{m,n}]
Out[2]= RSolve[{f[m,n]==f[-1+m,n]+f[m,-1+n]},f[m,n],{m,n}]

I know that Mathematica uses the creation of functional methods (probably by the way) to solve such relapses, but I do not know why this fails in such a simple case.

So do it manually.

Let g (x, n) be the generating function for f (m, n)
enter image description here

Now consider the sum f (m + 1, n) x ^ m enter image description here

: enter image description here

RSolve

In[3]:= RSolve[g[x,n]-x g[x,n]==g[x,n-1]&&g[x,0]==1/(1-x),g[x,n],n];
        Simplify[%,Element[n,Integers]]
Out[4]= {{g[x,n]->(1-x)^(-1-n)}}

x ^ m:

In[5]:= SeriesCoefficient[(1 - x)^(-1 - n), {x, 0, m}]
Out[5]= Piecewise[{{(-1)^m*Binomial[-1 - n, m], m >= 0}}, 0]

,

In[6]:= FullSimplify[(-1)^m*Binomial[-n - 1, m] == Binomial[m + n, m], Element[{n,m}, Integers]&&m>0&&n>0 ]
Out[6]= True

, Results!

In[7]:= ff[m_,n_]:=ff[m,n]=ff[m-1,n]+ff[m,n-1]
        ff[0,_]:=1;ff[_,0]:=1
In[9]:= And@@Flatten[Table[ff[m,n]==Binomial[n+m,m],{n,0,20},{m,0,20}]]
Out[9]= True

In[10]:= {f[m,n]==f[m,n-1]+f[m-1,n],f[0,n]==f[m,0]==1}/.f->(Binomial[#1+#2,#1]&)//FullSimplify
Out[10]= {True,True}
+9

, , ( {m, n} ):

RSolve[{f[m, n] == f[m, n - 1] + f[m - 1, n], f[0, n] == 1, f[m, 0] == 1}, f[m, n], {m, n}]

Mathematica . , .

+2

Source: https://habr.com/ru/post/1790859/


All Articles