10.6.4 problem 4

Internal problem ID [1221]
Book : Elementary differential equations and boundary value problems, 10th ed., Boyce and DiPrima
Section : Miscellaneous problems, end of chapter 2. Page 133
Problem number : 4
Date solved : Saturday, March 29, 2025 at 10:48:04 PM
CAS classification : [_separable]

\begin{align*} y^{\prime }&=3-6 x +y-2 x y \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 15
ode:=diff(y(x),x) = 3-6*x+y(x)-2*x*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -3+{\mathrm e}^{-x \left (x -1\right )} c_1 \]
Mathematica. Time used: 0.047 (sec). Leaf size: 24
ode=D[y[x],x] == 3-6*x+y[x]-2*x*y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -3+c_1 e^{x-x^2} \\ y(x)\to -3 \\ \end{align*}
Sympy. Time used: 0.263 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*y(x) + 6*x - y(x) + Derivative(y(x), x) - 3,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{x \left (1 - x\right )} - 3 \]