8.2.13 problem 17

Internal problem ID [673]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.3. Slope fields and solution curves. Page 26
Problem number : 17
Date solved : Saturday, March 29, 2025 at 10:12:17 PM
CAS classification : [_separable]

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

With initial conditions

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

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