11.19 problem 34

Internal problem ID [237]

Book: Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section: Section 5.5, Nonhomogeneous equations and undetermined coefficients Page 351
Problem number: 34.
ODE order: 2.
ODE degree: 1.

CAS Maple gives this as type [[_2nd_order, _linear, _nonhomogeneous]]

Solve \begin {gather*} \boxed {y^{\prime \prime }+y-\cos \relax (x )=0} \end {gather*} With initial conditions \begin {align*} [y \relax (0) = 1, y^{\prime }\relax (0) = -1] \end {align*}

Solution by Maple

Time used: 0.016 (sec). Leaf size: 16

dsolve([diff(y(x),x$2)+y(x)=cos(x),y(0) = 1, D(y)(0) = -1],y(x), singsol=all)
 

\[ y \relax (x ) = \frac {\left (-2+x \right ) \sin \relax (x )}{2}+\cos \relax (x ) \]

Solution by Mathematica

Time used: 0.01 (sec). Leaf size: 17

DSolve[{y''[x]+y[x]==Cos[x],{y[0]==1,y'[0]==-1}},y[x],x,IncludeSingularSolutions -> True]
 

\begin{align*} y(x)\to \frac {1}{2} (x-2) \sin (x)+\cos (x) \\ \end{align*}