60.3.4 problem 1004

Internal problem ID [11000]
Book : Differential Gleichungen, E. Kamke, 3rd ed. Chelsea Pub. NY, 1948
Section : Chapter 2, linear second order
Problem number : 1004
Date solved : Wednesday, March 05, 2025 at 01:37:00 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y-a \cos \left (b x \right )&=0 \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 27
ode:=diff(diff(y(x),x),x)+y(x)-a*cos(b*x) = 0; 
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.025 (sec). Leaf size: 30
ode=-(a*Cos[b*x]) + y[x] + D[y[x],{x,2}] == 0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {a \cos (b x)}{b^2-1}+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 0.088 (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} \]