89.17.1 problem 1

Internal problem ID [24693]
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 : 1
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 (b x \right ) \end{align*}
Maple. Time used: 0.005 (sec). Leaf size: 33
ode:=diff(diff(y(x),x),x)+a^2*y(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.114 (sec). Leaf size: 55
ode=D[y[x],{x,2}]+a^2*y[x]== 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.072 (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}} \]