75.16.53 problem 526

Internal problem ID [16955]
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. Trial and error method. Exercises page 132
Problem number : 526
Date solved : Monday, March 31, 2025 at 03:36:20 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }+2 y^{\prime }+2 y&=1+x \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 24
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+2*y(x) = 1+x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-x} \sin \left (x \right ) c_2 +{\mathrm e}^{-x} \cos \left (x \right ) c_1 +\frac {x}{2} \]
Mathematica. Time used: 0.017 (sec). Leaf size: 32
ode=D[y[x],{x,2}]+2*D[y[x],x]+2*y[x]==1+x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2} e^{-x} \left (e^x x+2 c_2 \cos (x)+2 c_1 \sin (x)\right ) \]
Sympy. Time used: 0.168 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + 2*y(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 )} = \frac {x}{2} + \left (C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )}\right ) e^{- x} \]