54.3.3 problem 1003

Internal problem ID [12298]
Book : Differential Gleichungen, E. Kamke, 3rd ed. Chelsea Pub. NY, 1948
Section : Chapter 2, linear second order
Problem number : 1003
Date solved : Wednesday, October 01, 2025 at 01:42:53 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y-\sin \left (n x \right )&=0 \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)+y(x)-sin(n*x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -\frac {\sin \left (n x \right )}{n^{2}-1} \]
Mathematica. Time used: 0.115 (sec). Leaf size: 55
ode=-Sin[n*x] + y[x] + D[y[x],{x,2}] == 0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \cos (x) \int _1^x-\sin (K[1]) \sin (n K[1])dK[1]+\sin (x) \int _1^x\cos (K[2]) \sin (n K[2])dK[2]+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.045 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
n = symbols("n") 
y = Function("y") 
ode = Eq(y(x) - sin(n*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 {\sin {\left (n x \right )}}{n^{2} - 1} \]