Mathematica 微分方程初始条件问题

Mathematica解微分方程时,加了初始条件出错!为什么?

如:

In[1]=DSolve[{y'[x]+y[x]==aSin[x],y[0]==0},y[x],x]

DSolve::deqn:Equation or list of equations expected instead of True in the first argument {y[x]+y'[x]==aSin[x],True}.>>

Out[1]=DSolve[{y[x]+y'[x]==aSin[x],True},y[x],x]

第1个回答  2010-04-27
In[286]:= DSolve[{y'[x] + y[x] == a*Sin[x], y[0] == 0}, y[x], x]

Out[286]= {{y[x] -> -(1/2) a E^-x (-1 + E^x Cos[x] - E^x Sin[x])}}

未发现问题;

In[287]:= y[0] = 0;
DSolve[{y'[x] + y[x] == a*Sin[x], y[0] == 0}, y[x], x]

DSolve::deqn:Equation or list of equations expected instead of True in the first argument {y[x]+y'[x]==aSin[x],True}.>>

Out[288]=DSolve[{y[x]+y'[x]==aSin[x],True},y[x],x]
发现问题;
说明是你在写方程之前,已经在什么时候对y[0]赋过值了.
你可以改成下面的形式,即使以前对y赋过值,也不会出错了.
Remove[y];
DSolve[{y'[x] + y[x] == a*Sin[x], y[0] == 0}, y[x], x]本回答被提问者采纳
相似回答