7.2.16 problem 18

Internal problem ID [34]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 1. First order differential equations. Section 1.3. Problems at page 27
Problem number : 18
Date solved : Saturday, March 29, 2025 at 04:26:48 PM
CAS classification : [_separable]

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

With initial conditions

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

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