89.17.2 problem 2

Internal problem ID [24694]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 9. Nonhomogeneous Equations: Undetermined coefficients. Exercises at page 145
Problem number : 2
Date solved : Thursday, October 02, 2025 at 10:47:10 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+a^{2} y&=\sin \left (a x \right ) \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)+a^2*y(x) = sin(a*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 (a x \right )-\cos \left (a x \right ) a x}{2 a^{2}} \]
Mathematica. Time used: 0.03 (sec). Leaf size: 29
ode=D[y[x],{x,2}]+a^2*y[x]== Sin[a*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \left (-\frac {x}{2 a}+c_1\right ) \cos (a x)+c_2 \sin (a x) \end{align*}
Sympy. Time used: 0.083 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(a**2*y(x) - sin(a*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 {x \cos {\left (a x \right )}}{2 a} \]