7.5.63 problem 64

Internal problem ID [167]
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.6 (substitution and exact equations). Problems at page 72
Problem number : 64
Date solved : Saturday, March 29, 2025 at 04:37:56 PM
CAS classification : [_Riccati]

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

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