29.2.16 problem 41

Internal problem ID [4649]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 2
Problem number : 41
Date solved : Tuesday, March 04, 2025 at 07:00:22 PM
CAS classification : [_Riccati]

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

Maple. Time used: 0.003 (sec). Leaf size: 62
ode:=diff(y(x),x)+1-x = (x+y(x))*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \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.212 (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