23.3.23 problem 9(d)

Internal problem ID [4164]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 4. The general linear differential equation of order n. Exercises at page 63
Problem number : 9(d)
Date solved : Tuesday, March 04, 2025 at 05:54:42 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 9 y^{\prime \prime }-6 y^{\prime }+y&=\left (4 x^{2}+24 x +18\right ) {\mathrm e}^{x} \end{align*}

With initial conditions

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

Maple. Time used: 0.020 (sec). Leaf size: 21
ode:=9*diff(diff(y(x),x),x)-6*diff(y(x),x)+y(x) = (4*x^2+24*x+18)*exp(x); 
ic:=y(0) = 3, D(y)(0) = 4; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y \left (x \right ) = \left (3 x +3\right ) {\mathrm e}^{\frac {x}{3}}+x^{2} {\mathrm e}^{x} \]
Mathematica. Time used: 0.025 (sec). Leaf size: 29
ode=9*D[y[x],{x,2}]-6*D[y[x],x]+y[x]==(4*x^2+24*x+18)*Exp[x]; 
ic={y[0]==3,Derivative[1][y][0] ==4}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{x/3} \left (e^{2 x/3} x^2+3 x+3\right ) \]
Sympy. Time used: 0.288 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((-4*x**2 - 24*x - 18)*exp(x) + y(x) - 6*Derivative(y(x), x) + 9*Derivative(y(x), (x, 2)),0) 
ics = {y(0): 3, Subs(Derivative(y(x), x), x, 0): 4} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (x^{2} e^{\frac {x}{3}} \sqrt [3]{e^{x}} + 3 x + 3\right ) e^{\frac {x}{3}} \]