DSolve second order ODE wrong solution
- To: mathgroup at smc.vnet.net
- Subject: [mg115009] DSolve second order ODE wrong solution
- From: Alberto Verga <Alberto.Verga at laposte.net>
- Date: Tue, 28 Dec 2010 06:50:11 -0500 (EST)
DSolve[] fails solving this second order, constant coefficients,
differential equation:
In[21]:=
deq = D[f[x], {x, 2}] + 2 D[f[x], x] + (1 + a^2) f[x] == 0
Out[21]=
(1 + a^2) f[x] + 2 Derivative[1][f][x] + (f^\[Prime]\[Prime])[x] == 0
In[22]:=
sol = DSolve[deq, f, x]
Out[22]=
{{f -> Function[{x}, C[2] Cos[(I + a) x] + C[1] Sin[(-I + a) x]]}}
In[24]:=
deq /. sol // FullSimplify
Out[24]=
{E^(x - I a x) ((-I + a) E^(2 I a x) C[1] + C[2] - I a C[2]) == 0}
The correct result is,
In[31]:=
correct = {f -> Function[x, c[1] Exp[-I (-I + a) x] + c[2] Exp[I (I +
a) x]]}
Out[31]=
{f -> Function[x, c[1] Exp[-I (-I + a) x] + c[2] Exp[I (I + a) x]]}
In[32]:=
deq /. correct // FullSimplify
Out[32]=
True
or equivalently:
In[33]:= correct1 = {f -> Function[x, c[1] Exp[-x] Sin[a x + c[2]]]}
Out[33]= {f -> Function[x, c[1] Exp[-x] Sin[a x + c[2]]]}
In[34]:= deq /. correct1 // FullSimplify
Out[34]= True
However, changing the coefficient 1+a^2=b, gives
In[36]:=
deqb = D[f[x], {x, 2}] + 2 D[f[x], x] + b f[x] == 0;
solb = DSolve[deqb, f, x];
deqb /. solb // FullSimplify
Out[38]=
{True}
Thanks!