- Split input into 2 regimes
if (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < -1.0851674992178994e-07 or 5.9324951686377854e-08 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1)
Initial program 0.2
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
- Using strategy
rm Applied expm1-log1p-u0.2
\[\leadsto \frac{2}{\color{blue}{(e^{\log_* (1 + \left(1 + e^{-2 \cdot x}\right))} - 1)^*}} - 1\]
if -1.0851674992178994e-07 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 5.9324951686377854e-08
Initial program 59.8
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
Taylor expanded around 0 0
\[\leadsto \color{blue}{\left(x + \frac{2}{15} \cdot {x}^{5}\right) - \frac{1}{3} \cdot {x}^{3}}\]
- Recombined 2 regimes into one program.
Final simplification0.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le -1.0851674992178994 \cdot 10^{-07}:\\
\;\;\;\;\frac{2}{(e^{\log_* (1 + \left(1 + e^{-2 \cdot x}\right))} - 1)^*} - 1\\
\mathbf{elif}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 5.9324951686377854 \cdot 10^{-08}:\\
\;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - {x}^{3} \cdot \frac{1}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{(e^{\log_* (1 + \left(1 + e^{-2 \cdot x}\right))} - 1)^*} - 1\\
\end{array}\]