Message Boards Message Boards

[✓] Solve a differential equation with DSolve?


I am trying to show that -e^-x(-2-pi+2e^xSin[x]) satisfies the differential equation y'[t]+y[t]==4Sin[t] by plugging it in.

I put

DSolve[y'[t] + y[t] == 4 Sin[t], y[t], t]

into Mathematica but am always getting the error DSolve: cannot be used as a function and the solution it gives is DSolve[aSin[t]==4Sin[t].e^-t C[1]+e^-t integral of e^k(aSin[K[1]] dk[1], t].

How do I fix this to make it output the correct differential equations like it does in the examples?

POSTED BY: Brian Cao
25 days ago

It's E for $e$, Pi for $\pi$, and generally starting-with-capitals in Mathematica, and make sure you have spaces or a * between things being multiplied.

POSTED BY: Michael Rogers
25 days ago


They are not equal.

If you substitute your expression (as fixed by Michael's suggestions above) you get:

In[8]:= yy[x] = E^-x (2 + Pi) - 2 Sin[x]

Out[8]= E^-x (2 + \[Pi]) - 2 Sin[x]

In[12]:= FullSimplify[D[yy[x], x] + yy[x] == 4 Sin[x]]

Out[12]= Cos[x] + 3 Sin[x] == 0

And you can verify this another way by directly solving the original equation:

In[3]:= ans = DSolve[y'[t] + y[t] == 4 Sin[t], y[t], t]

Out[3]= {{y[t] -> E^-t C[1] + 2 (-Cos[t] + Sin[t])}}
POSTED BY: Neil Singer
25 days ago

Group Abstract Group Abstract