34.10.8 problem 17

Internal problem ID [8017]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 15. Linear equations with constant coefficients (Variation of parameters). Supplemetary problems. Page 98
Problem number : 17
Date solved : Tuesday, September 30, 2025 at 05:14:18 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y^{\prime }+2 y&=x^{2}+\sin \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 38
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+2*y(x) = x^2+sin(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}}{2}-x +\frac {1}{2}-\frac {2 \cos \left (x \right )}{5}+\frac {\sin \left (x \right )}{5} \]
Mathematica. Time used: 0.103 (sec). Leaf size: 75
ode=D[y[x],{x,2}]+2*D[y[x],x]+2*y[x]==x^2+Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\cos (x) \int _1^x-e^{K[2]} \sin (K[2]) \left (K[2]^2+\sin (K[2])\right )dK[2]+\sin (x) \int _1^xe^{K[1]} \cos (K[1]) \left (K[1]^2+\sin (K[1])\right )dK[1]+c_2 \cos (x)+c_1 \sin (x)\right ) \end{align*}
Sympy. Time used: 0.155 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 2*y(x) - sin(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{2}}{2} - x + \left (C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )}\right ) e^{- x} + \frac {\sin {\left (x \right )}}{5} - \frac {2 \cos {\left (x \right )}}{5} + \frac {1}{2} \]