本文介绍了如何求解数学中递推关系的解析解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下重复:

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

我尝试使用 RSolve,但出现错误:

I tried to use RSolve, but I got an error:

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

感谢您的帮助!

推荐答案

差分方程和初始条件为

Mathematica(7 和 8)不喜欢求解它......无论有没有初始条件.RSolve 表达式未计算

Mathematica (7 and 8) does not like solving it... both with and without initial conditions. The RSolve expressions are left unevaluated

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}]

知道 Mathematica 使用 生成函数方法(可能除其他外)来解决此类重复问题,但我不知道为什么它会在这种情况下失败简单的案例.

I know that Mathematica uses generating functional methods (probably among other things) to solve such recurrences, but I don't know why it fails in such a simple case.

所以让我们手工完成.

设 g(x,n) 为 f(m,n) 的生成函数

Let g(x,n) be the generating function for f(m,n)

现在检查 f(m+1,n) x^m 的总和

Now examine the sum of f(m+1,n) x^m

现在求解简单的代数差分方程:

Now solve the simple algebraic-difference equation:

也可以用 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的系数:

Now extract the coefficient of 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

所以我们终于得到

这可以使用符号和数字方法进行检查

This can be checked using symbolic and numeric means

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}

这篇关于如何求解数学中递推关系的解析解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 03:16