69.3.5 problem 45

Internal problem ID [17989]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Section 3. The method of successive approximation. Exercises page 31
Problem number : 45
Date solved : Thursday, October 02, 2025 at 02:32:25 PM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (1\right )&=2 \\ \end{align*}
Maple. Time used: 0.017 (sec). Leaf size: 9
ode:=x*diff(y(x),x) = 2*x-y(x); 
ic:=[y(1) = 2]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = x +\frac {1}{x} \]
Mathematica. Time used: 0.017 (sec). Leaf size: 10
ode=x*D[y[x],x]==2*x-y[x]; 
ic={y[1]==2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x+\frac {1}{x} \end{align*}
Sympy. Time used: 0.094 (sec). Leaf size: 7
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) - 2*x + y(x),0) 
ics = {y(1): 2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x + \frac {1}{x} \]