23.1.7 problem 1(g)

Internal problem ID [4097]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 2. First order equations. Exercises at page 14
Problem number : 1(g)
Date solved : Sunday, March 30, 2025 at 02:17:39 AM
CAS classification : [_linear]

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

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