ODE
\[ a^2 y(x)+y''(x)=\cos (b x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.173507 (sec), leaf count = 55
\[\left \{\left \{y(x)\to \frac {c_2 \left (a^2-b^2\right ) \sin (a x)+c_1 \left (a^2-b^2\right ) \cos (a x)+\cos (b x)}{(a-b) (a+b)}\right \}\right \}\]
Maple ✓
cpu = 0.063 (sec), leaf count = 33
\[ \left \{ y \left ( x \right ) =\sin \left ( ax \right ) {\it \_C2}+\cos \left ( ax \right ) {\it \_C1}+{\frac {\cos \left ( bx \right ) }{{a}^{2}-{b}^{2}}} \right \} \] Mathematica raw input
DSolve[a^2*y[x] + y''[x] == Cos[b*x],y[x],x]
Mathematica raw output
{{y[x] -> ((a^2 - b^2)*C[1]*Cos[a*x] + Cos[b*x] + (a^2 - b^2)*C[2]*Sin[a*x])/((a
- b)*(a + b))}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+a^2*y(x) = cos(b*x), y(x),'implicit')
Maple raw output
y(x) = sin(a*x)*_C2+cos(a*x)*_C1+cos(b*x)/(a^2-b^2)