76.1.24 problem 24

Internal problem ID [17252]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 2. First order differential equations. Section 2.1 (Separable equations). Problems at page 44
Problem number : 24
Date solved : Monday, March 31, 2025 at 03:46:31 PM
CAS classification : [_separable]

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

With initial conditions

\begin{align*} y \left (1\right )&=2 \end{align*}

Maple. Time used: 0.029 (sec). Leaf size: 17
ode:=x^2*diff(y(x),x) = y(x)-x*y(x); 
ic:=y(1) = 2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {2 \,{\mathrm e}^{\frac {x -1}{x}}}{x} \]
Mathematica. Time used: 0.039 (sec). Leaf size: 19
ode=x^2*D[y[x],x]==y[x]-x*y[x]; 
ic={y[1]==2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {2 e^{1-\frac {1}{x}}}{x} \]
Sympy. Time used: 0.324 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), x) + x*y(x) - y(x),0) 
ics = {y(1): 2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {2 e e^{- \frac {1}{x}}}{x} \]