69.17.30 problem 580

Internal problem ID [18366]
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 : 580
Date solved : Thursday, October 02, 2025 at 03:10:59 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+2 y^{\prime }+y^{\prime \prime }&=1+2 \cos \left (x \right )+\cos \left (2 x \right )-\sin \left (2 x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = 1+2*cos(x)+cos(2*x)-sin(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = 1+\left (c_1 x +c_2 \right ) {\mathrm e}^{-x}+\sin \left (x \right )+\frac {\cos \left (2 x \right )}{25}+\frac {7 \sin \left (2 x \right )}{25} \]
Mathematica. Time used: 0.55 (sec). Leaf size: 85
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==1+2*Cos[x]+Cos[2*x]-Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\int _1^x-e^{K[1]} K[1] (2 \cos (K[1])+\cos (2 K[1])-\sin (2 K[1])+1)dK[1]+x \int _1^xe^{K[2]} (2 \cos (K[2])+\cos (2 K[2])-\sin (2 K[2])+1)dK[2]+c_2 x+c_1\right ) \end{align*}
Sympy. Time used: 0.216 (sec). Leaf size: 49
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + sin(2*x) - 2*cos(x) - cos(2*x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + C_{2} x\right ) e^{- x} + \sin {\left (x \right )} + \frac {4 \sqrt {2} \sin {\left (2 x + \frac {\pi }{4} \right )}}{25} - \frac {3 \sqrt {2} \cos {\left (2 x + \frac {\pi }{4} \right )}}{25} + 1 \]