69.17.22 problem 572

Internal problem ID [18358]
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 15.3 Nonhomogeneous linear equations with constant coefficients. Superposition principle. Exercises page 137
Problem number : 572
Date solved : Thursday, October 02, 2025 at 03:10:51 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 4 y+y^{\prime \prime }&={\mathrm e}^{x}+4 \sin \left (2 x \right )+2 \cos \left (x \right )^{2}-1 \end{align*}
Maple. Time used: 0.006 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)+4*y(x) = exp(x)+4*sin(2*x)+2*cos(x)^2-1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (2+x +4 c_2 \right ) \sin \left (2 x \right )}{4}+\left (-x +c_1 \right ) \cos \left (2 x \right )+\frac {{\mathrm e}^{x}}{5} \]
Mathematica. Time used: 0.233 (sec). Leaf size: 96
ode=D[y[x],{x,2}]+4*y[x]==Exp[x]+4*Sin[2*x]+2*Cos[x]^2-1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \cos (2 x) \int _1^x-\frac {1}{2} \sin (2 K[1]) \left (\cos (2 K[1])+e^{K[1]}+4 \sin (2 K[1])\right )dK[1]+\sin (2 x) \int _1^x\frac {1}{2} \cos (2 K[2]) \left (\cos (2 K[2])+e^{K[2]}+4 \sin (2 K[2])\right )dK[2]+c_1 \cos (2 x)+c_2 \sin (2 x) \end{align*}
Sympy. Time used: 0.556 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - exp(x) - 4*sin(2*x) - 2*cos(x)**2 + Derivative(y(x), (x, 2)) + 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - x\right ) \cos {\left (2 x \right )} + \left (C_{2} + \frac {x}{4}\right ) \sin {\left (2 x \right )} + \frac {e^{x}}{5} \]