2.7   ODE No. 7

  1. Problem in Latex
  2. Mathematica input
  3. Maple input

\[ y'(x)+y(x) \cos (x)-e^{-\sin (x)}=0 \] Mathematica : cpu = 0.0324698 (sec), leaf count = 23

\[\left \{\left \{y(x)\to x e^{-\sin (x)}+c_1 e^{-\sin (x)}\right \}\right \}\] Maple : cpu = 0.006 (sec), leaf count = 13

\[ \left \{ y \left ( x \right ) = \left ( x+{\it \_C1} \right ) {{\rm e}^{-\sin \left ( x \right ) }} \right \} \]

Hand solution

\begin {equation} \frac {dy}{dx}+y\left ( x\right ) \cos \left ( x\right ) =e^{-\sin \left ( x\right ) }\tag {1} \end {equation}

Integrating factor \(\mu =e^{\int \cos dx}=e^{\sin x}\). Hence (1) becomes

\[ \frac {d}{dx}\left ( \mu y\left ( x\right ) \right ) =\mu e^{-\sin \left ( x\right ) }\]

Replacing \(\mu \) by \(e^{\sin x}\) and integrating both sides

\begin {align*} e^{\sin x}y\left ( x\right ) & =\int e^{\sin x}e^{-\sin \left ( x\right ) }dx+C\\ e^{\sin x}y\left ( x\right ) & =\int dx+C\\ e^{\sin x}y\left ( x\right ) & =x+C\\ y\left ( x\right ) & =xe^{-\sin x}+Ce^{-\sin \left ( x\right ) } \end {align*}