23.3.32 problem 32

Internal problem ID [5746]
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 : 32
Date solved : Tuesday, September 30, 2025 at 02:02:26 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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