85.35.6 problem 13

Internal problem ID [22726]
Book : Applied Differential Equations. By Murray R. Spiegel. 3rd edition. 1980. Pearson. ISBN 978-0130400970
Section : Chapter two. First order and simple higher order ordinary differential equations. C Exercises at page 68
Problem number : 13
Date solved : Thursday, October 02, 2025 at 09:14:02 PM
CAS classification : [_Riccati]

\begin{align*} y^{\prime }&=x y^{2}-2 y+4-4 x \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 62
ode:=diff(y(x),x) = x*y(x)^2-2*y(x)+4-4*x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = 2-\frac {{\mathrm e}^{2 x^{2}-2 x}}{\frac {{\mathrm e}^{2 x^{2}-2 x}}{4}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (i \sqrt {2}\, x -\frac {i \sqrt {2}}{2}\right )}{8}-c_1} \]
Mathematica. Time used: 0.244 (sec). Leaf size: 103
ode=D[y[x],x]==x*y[x]^2-2*y[x]+4-4*x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {2 \left (\sqrt {2 \pi } \text {erfi}\left (\frac {1-2 x}{\sqrt {2}}\right )+2 e^{\frac {1}{2} (1-2 x)^2}-8 \sqrt {e} c_1\right )}{\sqrt {2 \pi } \text {erfi}\left (\frac {2 x-1}{\sqrt {2}}\right )+2 e^{2 (x-1) x+\frac {1}{2}}+8 \sqrt {e} c_1}\\ y(x)&\to 2 \end{align*}
Sympy. Time used: 102.436 (sec). Leaf size: 189
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*y(x)**2 + 4*x + 2*y(x) + Derivative(y(x), x) - 4,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {2 \left (2 \left (2 x + 1\right ) e^{- 2 x} e^{2 x^{2}} + 4 \int e^{- 2 x} e^{2 x^{2}}\, dx - 3 \int \frac {e^{- 2 x} e^{2 x^{2}}}{x}\, dx - 4 \int x e^{- 2 x} e^{2 x^{2}}\, dx - 16 \int x^{3} e^{- 2 x} e^{2 x^{2}}\, dx + 2 e^{- 2 x} e^{2 x^{2}}\right )}{2 \left (2 x + 1\right ) e^{- 2 x} e^{2 x^{2}} + 4 \int e^{- 2 x} e^{2 x^{2}}\, dx - 3 \int \frac {e^{- 2 x} e^{2 x^{2}}}{x}\, dx - 4 \int x e^{- 2 x} e^{2 x^{2}}\, dx - 16 \int x^{3} e^{- 2 x} e^{2 x^{2}}\, dx} \]