12.1.2 problem 2(b)

Internal problem ID [1520]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 1, Introduction. Section 1.2 Page 14
Problem number : 2(b)
Date solved : Saturday, March 29, 2025 at 10:57:27 PM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+y&=x^{2} \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 16
ode:=x*diff(y(x),x)+y(x) = x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {x^{3}+3 c_1}{3 x} \]
Mathematica. Time used: 0.027 (sec). Leaf size: 19
ode=x*D[y[x],x] +y[x]== x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {x^2}{3}+\frac {c_1}{x} \]
Sympy. Time used: 0.177 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + x*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} + \frac {x^{3}}{3}}{x} \]