23.2.20 problem 6(i)

Internal problem ID [4137]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 3. Linear differential equations of second order. Exercises at page 31
Problem number : 6(i)
Date solved : Sunday, March 30, 2025 at 02:40:45 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.005 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)-y(x) = 4*x*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-x} c_1 +{\mathrm e}^{x} \left (x^{2}+c_2 -x \right ) \]
Mathematica. Time used: 0.02 (sec). Leaf size: 30
ode=D[y[x],{x,2}]-y[x]==4*x*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^x \left (x^2-x+\frac {1}{2}+c_1\right )+c_2 e^{-x} \]
Sympy. Time used: 0.102 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-4*x*exp(x) - y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- x} + \left (C_{1} + x^{2} - x\right ) e^{x} \]