23.3.9 problem 9

Internal problem ID [5723]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 9
Date solved : Tuesday, September 30, 2025 at 02:02:07 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+y^{\prime \prime }&=a \cos \left (b x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 27
ode:=y(x)+diff(diff(y(x),x),x) = a*cos(b*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -\frac {a \cos \left (b x \right )}{b^{2}-1} \]
Mathematica. Time used: 0.013 (sec). Leaf size: 30
ode=y[x] + D[y[x],{x,2}] == a*Cos[b*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {a \cos (b x)}{b^2-1}+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.055 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
y = Function("y") 
ode = Eq(-a*cos(b*x) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} - \frac {a \cos {\left (b x \right )}}{b^{2} - 1} \]