27.1.2 problem 2

Internal problem ID [4296]
Book : An introduction to the solution and applications of differential equations, J.W. Searl, 1966
Section : Chapter 4, Ex. 4.1
Problem number : 2
Date solved : Sunday, March 30, 2025 at 02:52:42 AM
CAS classification : [[_homogeneous, `class A`], _exact, _rational, [_Abel, `2nd type`, `class A`]]

\begin{align*} x +y+\left (x -y\right ) y^{\prime }&=0 \end{align*}

With initial conditions

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

Maple. Time used: 0.060 (sec). Leaf size: 22
ode:=x+y(x)+(x-y(x))*diff(y(x),x) = 0; 
ic:=y(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\begin{align*} y &= \left (1+\sqrt {2}\right ) x \\ y &= -\left (\sqrt {2}-1\right ) x \\ \end{align*}
Mathematica. Time used: 0.445 (sec). Leaf size: 40
ode=(x+y[x])+(x-y[x])*D[y[x],x]==0; 
ic=y[0]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to x-\sqrt {2} \sqrt {x^2} \\ y(x)\to \sqrt {2} \sqrt {x^2}+x \\ \end{align*}
Sympy. Time used: 1.145 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x + (x - y(x))*Derivative(y(x), x) + y(x),0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = x - \sqrt {2} \sqrt {x^{2}}, \ y{\left (x \right )} = x + \sqrt {2} \sqrt {x^{2}}\right ] \]