25.1.24 problem 24

Internal problem ID [4236]
Book : Advanced Mathematica, Book2, Perkin and Perkin, 1992
Section : Chapter 11.3, page 316
Problem number : 24
Date solved : Tuesday, March 04, 2025 at 05:57:18 PM
CAS classification : [_separable]

\begin{align*} {\mathrm e}^{y} y^{\prime }+2 x&=2 x \,{\mathrm e}^{y} \end{align*}

Maple. Time used: 0.030 (sec). Leaf size: 19
ode:=exp(y(x))*diff(y(x),x)+2*x = 2*x*exp(y(x)); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = -\ln \left (-\frac {1}{{\mathrm e}^{x^{2}} c_{1} -1}\right ) \]
Mathematica. Time used: 2.001 (sec). Leaf size: 21
ode=Exp[y[x]]*D[y[x],x]+2*x==2*x*Exp[y[x]]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \log \left (1+e^{x^2+c_1}\right ) \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 0.306 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x*exp(y(x)) + 2*x + exp(y(x))*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \log {\left (C_{1} e^{x^{2}} + 1 \right )} \]