36.4.4 problem 4

Internal problem ID [6342]
Book : Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
Section : Chapter 2, First order differential equations. Review problems. page 79
Problem number : 4
Date solved : Sunday, March 30, 2025 at 10:52:50 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }+\frac {3 y}{x}&=x^{2}-4 x +3 \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 23
ode:=diff(y(x),x)+3*y(x)/x = x^2-4*x+3; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {x^{3}}{6}-\frac {4 x^{2}}{5}+\frac {3 x}{4}+\frac {c_1}{x^{3}} \]
Mathematica. Time used: 0.048 (sec). Leaf size: 31
ode=D[y[x],x]+3*y[x]/x==x^2-4*x+3; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {x^3}{6}+\frac {c_1}{x^3}-\frac {4 x^2}{5}+\frac {3 x}{4} \]
Sympy. Time used: 0.217 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 4*x + Derivative(y(x), x) - 3 + 3*y(x)/x,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} + \frac {x^{4} \left (10 x^{2} - 48 x + 45\right )}{60}}{x^{3}} \]