29.3.10 problem 10

Internal problem ID [7249]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 3. Linear First-Order Equations. page 403
Problem number : 10
Date solved : Tuesday, September 30, 2025 at 04:26:12 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }+y \tanh \left (x \right )&=2 \,{\mathrm e}^{x} \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 15
ode:=diff(y(x),x)+y(x)*tanh(x) = 2*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_1 +x \right ) \operatorname {sech}\left (x \right )+\cosh \left (x \right )+\sinh \left (x \right ) \]
Mathematica. Time used: 0.053 (sec). Leaf size: 58
ode=D[y[x],x]+y[x]*Tanh[x]==2*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {\sqrt {e^{2 x}} \left (\int _1^x\frac {2 e^{K[1]} \left (1+e^{2 K[1]}\right )}{\sqrt {e^{2 K[1]}}}dK[1]+c_1\right )}{e^{2 x}+1} \end{align*}
Sympy. Time used: 1.614 (sec). Leaf size: 34
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*tanh(x) - 2*exp(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ - \int \frac {2 e^{2 x}}{\tanh {\left (x \right )} + 1}\, dx - \int \left (- \frac {y{\left (x \right )} e^{x} \tanh {\left (x \right )}}{\tanh {\left (x \right )} + 1}\right )\, dx = C_{1} \]