75.25.3 problem 759

Internal problem ID [17155]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Chapter 2 (Higher order ODEs). Section 18.3. Finding periodic solutions of linear differential equations. Exercises page 187
Problem number : 759
Date solved : Monday, March 31, 2025 at 03:43:27 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y&=\cos \left (\pi x \right ) \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)-4*y(x) = cos(Pi*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{2 x} c_2 +{\mathrm e}^{-2 x} c_1 -\frac {\cos \left (\pi x \right )}{\pi ^{2}+4} \]
Mathematica. Time used: 0.082 (sec). Leaf size: 72
ode=D[y[x],{x,2}]-4*y[x]==Cos[Pi*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-2 x} \left (e^{4 x} \int _1^x\frac {1}{4} e^{-2 K[1]} \cos (\pi K[1])dK[1]+\int _1^x-\frac {1}{4} e^{2 K[2]} \cos (\pi K[2])dK[2]+c_1 e^{4 x}+c_2\right ) \]
Sympy. Time used: 0.112 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-4*y(x) - cos(pi*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 2 x} + C_{2} e^{2 x} - \frac {\cos {\left (\pi x \right )}}{4 + \pi ^{2}} \]