第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]本回答被提问者采纳