Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Yesterday,I use the Mathematica to solve a Differential Equation by the command DSolve:

DSolve[y''[x] + 2 y'[x] + 5 y[x] == x Cos[x], y[x], x]

{{y[x] -> E^-x C[2] Cos[2 x] + E^-x C1 Sin[2 x] + 1/200 (-25 Cos[x] Cos[2 x] + 25 x Cos[x] Cos[2 x] - 3 Cos[2 x] Cos[3 x] + 15 x Cos[2 x] Cos[3 x] - 25 x Cos[2 x] Sin[x] + 25 x Cos[x] Sin[2 x] + 4 Cos[3 x] Sin[2 x] + 5 x Cos[3 x] Sin[2 x] - 25 Sin[x] Sin[2 x] + 25 x Sin[x] Sin[2 x] - 4 Cos[2 x] Sin[3 x] - 5 x Cos[2 x] Sin[3 x] - 3 Sin[2 x] Sin[3 x] + 15 x Sin[2 x] Sin[3 x])}}

However,I feel the result is very complex.So I caculate it by hand.Below is my process.

Characteristic equation: r^2+2*r+5==0 r1=-1+2 I,r2=-1-2 I

So the Nonhomogenerous equation general solution is: E^-x(C1 Cos[2x]+C2 Sin[2x])

I use the Differential Operator method to caculate the nonhomogenerous particular solution: Differential Operator method

So my question is why the two result is different?Can someone tell me the reason? Thanks sincerely!!

share|improve this question
3  
If you simplify M answer, then it becomes: Simplify[%]; y[x] -> 1/50 E^-x (50 C[2] Cos[2 x] + E^x (-1 + 5 x) Sin[x] +Cos[x] (E^x (-7 + 10 x) + 100 C[1] Sin[x])) –  Nasser Nov 17 '13 at 3:35

1 Answer 1

up vote 7 down vote accepted

They are the same answer, as verified below. You can use the Simplify command to simplify things if needed:

mma = y[x] /. First@DSolve[y''[x] + 2 y'[x] + 5 y[x] == x Cos[x], y[x], x];
handH = E^(-x)*(C[2] Cos[2 x] + C[1] Sin[2 x]);
handP = (1/5 x - 7/50) Cos[x] + (1/10 x - 1/50) Sin[x];
hand = handH + handP;
Simplify[mma - hand]

and the answer is

                                0

QED

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.