50.2.16 problem 2(e)

Internal problem ID [7822]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 1. What is a differential equation. Section 1.3 SEPARABLE EQUATIONS. Page 12
Problem number : 2(e)
Date solved : Wednesday, March 05, 2025 at 05:07:13 AM
CAS classification : [_separable]

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

With initial conditions

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

Maple. Time used: 0.036 (sec). Leaf size: 20
ode:=diff(y(x),x)*(1+y(x)) = -x^2+1; 
ic:=y(-1) = -2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -1-\frac {\sqrt {-6 x^{3}+18 x +21}}{3} \]
Mathematica. Time used: 0.156 (sec). Leaf size: 28
ode=D[y[x],x]*(1+y[x])==1-x^2; 
ic={y[-1]==-2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {\sqrt {-2 x^3+6 x+7}}{\sqrt {3}}-1 \]
Sympy. Time used: 0.461 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2 + (y(x) + 1)*Derivative(y(x), x) - 1,0) 
ics = {y(-1): -2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = - \frac {\sqrt {- 6 x^{3} + 18 x + 21}}{3} - 1 \]