17.1.19 problem 2(i)

Internal problem ID [4109]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 2. First order equations. Exercises at page 14
Problem number : 2(i)
Date solved : Tuesday, September 30, 2025 at 07:03:01 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (1\right )&=1 \\ \end{align*}
Maple. Time used: 0.036 (sec). Leaf size: 19
ode:=x*diff(y(x),x)+2*y(x) = (3*x+2)*exp(3*x); 
ic:=[y(1) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = {\mathrm e}^{3 x}+\frac {1-{\mathrm e}^{3}}{x^{2}} \]
Mathematica. Time used: 0.067 (sec). Leaf size: 22
ode=x*D[y[x],x]+2*y[x]==(3*x+2)*Exp[3*x]; 
ic=y[1]==1; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {e^3}{x^2}+\frac {1}{x^2}+e^{3 x} \end{align*}
Sympy. Time used: 0.169 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) - (3*x + 2)*exp(3*x) + 2*y(x),0) 
ics = {y(1): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = e^{3 x} + \frac {1 - e^{3}}{x^{2}} \]