20.9.12 problem Problem 12

Internal problem ID [3756]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 8, Linear differential equations of order n. Section 8.7, The Variation of Parameters Method. page 556
Problem number : Problem 12
Date solved : Sunday, March 30, 2025 at 02:07:28 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 27
ode:=diff(diff(y(x),x),x)-y(x) = 2*tanh(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{x} \left (2 \arctan \left ({\mathrm e}^{x}\right )+c_1 \right )+{\mathrm e}^{-x} \left (2 \arctan \left ({\mathrm e}^{x}\right )+c_2 \right ) \]
Mathematica. Time used: 0.056 (sec). Leaf size: 35
ode=D[y[x],{x,2}]-y[x]==2*Tanh[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-x} \left (2 \left (e^{2 x}+1\right ) \arctan \left (e^x\right )+c_1 e^{2 x}+c_2\right ) \]
Sympy. Time used: 0.794 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x) - 2*tanh(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - \int e^{x} \tanh {\left (x \right )}\, dx\right ) e^{- x} + \left (C_{2} + \int e^{- x} \tanh {\left (x \right )}\, dx\right ) e^{x} \]