75.18.11 problem 600

Internal problem ID [17028]
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. Initial value problem. Exercises page 140
Problem number : 600
Date solved : Monday, March 31, 2025 at 03:38:34 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }+5 y&=2 x^{2} {\mathrm e}^{x} \end{align*}

With initial conditions

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

Maple. Time used: 0.061 (sec). Leaf size: 23
ode:=diff(diff(y(x),x),x)-4*diff(y(x),x)+5*y(x) = 2*x^2*exp(x); 
ic:=y(0) = 2, D(y)(0) = 3; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = {\mathrm e}^{x} \left (\left (-2 \sin \left (x \right )+\cos \left (x \right )\right ) {\mathrm e}^{x}+\left (x +1\right )^{2}\right ) \]
Mathematica. Time used: 0.022 (sec). Leaf size: 28
ode=D[y[x],{x,2}]-4*D[y[x],x]+5*y[x]==2*x^2*Exp[x]; 
ic={y[0]==2,Derivative[1][y][0] ==3}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^x \left ((x+1)^2-2 e^x \sin (x)+e^x \cos (x)\right ) \]
Sympy. Time used: 0.254 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x**2*exp(x) + 5*y(x) - 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 2, Subs(Derivative(y(x), x), x, 0): 3} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (x^{2} + 2 x + \left (- 2 \sin {\left (x \right )} + \cos {\left (x \right )}\right ) e^{x} + 1\right ) e^{x} \]