18.1.15 problem Problem 14.17

Internal problem ID [3471]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 14, First order ordinary differential equations. 14.4 Exercises, page 490
Problem number : Problem 14.17
Date solved : Tuesday, March 04, 2025 at 04:41:21 PM
CAS classification : [[_homogeneous, `class G`], _exact, _rational, [_Abel, `2nd type`, `class B`]]

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

With initial conditions

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

Maple. Time used: 0.103 (sec). Leaf size: 37
ode:=x*(1-2*x^2*y(x))*diff(y(x),x)+y(x) = 3*x^2*y(x)^2; 
ic:=y(1) = 1/2; 
dsolve([ode,ic],y(x), singsol=all);
 
\begin{align*} y \left (x \right ) &= \frac {1-\sqrt {1-x}}{2 x^{2}} \\ y \left (x \right ) &= \frac {1+\sqrt {1-x}}{2 x^{2}} \\ \end{align*}
Mathematica. Time used: 0.7 (sec). Leaf size: 53
ode=x*(1-2*x^2*y[x])*D[y[x],x] +y[x] == 3*x^2*y[x]^2; 
ic=y[1]==1/2; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {x-\sqrt {-\left ((x-1) x^2\right )}}{2 x^3} \\ y(x)\to \frac {\sqrt {-\left ((x-1) x^2\right )}+x}{2 x^3} \\ \end{align*}
Sympy. Time used: 1.029 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*x**2*y(x)**2 + x*(-2*x**2*y(x) + 1)*Derivative(y(x), x) + y(x),0) 
ics = {y(1): 1/2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \frac {1 - \sqrt {1 - x}}{2 x^{2}}, \ y{\left (x \right )} = \frac {\sqrt {1 - x} + 1}{2 x^{2}}\right ] \]