23.1.48 problem 42

Internal problem ID [4655]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 1. THE DIFFERENTIAL EQUATION IS OF FIRST ORDER AND OF FIRST DEGREE, page 223
Problem number : 42
Date solved : Tuesday, September 30, 2025 at 07:38:19 AM
CAS classification : [_Riccati]

\begin{align*} y^{\prime }+1-x&=\left (x +y\right ) y \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 62
ode:=diff(y(x),x)+1-x = (x+y(x))*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-i \sqrt {\pi }\, {\mathrm e}^{-2} \sqrt {2}\, \operatorname {erf}\left (\frac {i \sqrt {2}\, \left (x -2\right )}{2}\right )+2 \,{\mathrm e}^{\frac {x \left (x -4\right )}{2}}-2 c_1}{i \sqrt {\pi }\, {\mathrm e}^{-2} \sqrt {2}\, \operatorname {erf}\left (\frac {i \sqrt {2}\, \left (x -2\right )}{2}\right )+2 c_1} \]
Mathematica. Time used: 0.142 (sec). Leaf size: 54
ode=D[y[x],x]+1-x==(x+y[x])*y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -1+\frac {2 e^{\frac {1}{2} (x-2)^2}}{-\sqrt {2 \pi } \text {erfi}\left (\frac {x-2}{\sqrt {2}}\right )+2 e^2 c_1}\\ y(x)&\to -1 \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x - (x + y(x))*y(x) + Derivative(y(x), x) + 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
TypeError : bad operand type for unary -: list