15.15.10 problem 11

Internal problem ID [3214]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 24, page 109
Problem number : 11
Date solved : Sunday, March 30, 2025 at 01:21:22 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+3 y^{\prime }+2 y&=x^{2} \cos \left (x \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 46
ode:=diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = x^2*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -{\mathrm e}^{-2 x} c_1 +{\mathrm e}^{-x} c_2 +\frac {\left (25 x^{2}+60 x -133\right ) \cos \left (x \right )}{250}+\frac {\sin \left (x \right ) \left (75 x^{2}-170 x +81\right )}{250} \]
Mathematica. Time used: 0.03 (sec). Leaf size: 53
ode=D[y[x],{x,2}]+3*D[y[x],x]+2*y[x]==x^2*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{250} \left (\left (75 x^2-170 x+81\right ) \sin (x)+\left (25 x^2+60 x-133\right ) \cos (x)\right )+c_1 e^{-2 x}+c_2 e^{-x} \]
Sympy. Time used: 0.326 (sec). Leaf size: 63
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*cos(x) + 2*y(x) + 3*Derivative(y(x), 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^{- x} + \frac {3 x^{2} \sin {\left (x \right )}}{10} + \frac {x^{2} \cos {\left (x \right )}}{10} - \frac {17 x \sin {\left (x \right )}}{25} + \frac {6 x \cos {\left (x \right )}}{25} + \frac {81 \sin {\left (x \right )}}{250} - \frac {133 \cos {\left (x \right )}}{250} \]