- Split input into 3 regimes
if (/ (- (exp x) 1) x) < 0.0
Initial program 62.0
\[\frac{e^{x} - 1}{x}\]
Taylor expanded around 0 0
\[\leadsto \color{blue}{\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)}\]
- Using strategy
rm Applied add-cbrt-cube0
\[\leadsto \color{blue}{\sqrt[3]{\left(\left(\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)\right) \cdot \left(\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)\right)\right) \cdot \left(\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)\right)}}\]
if 0.0 < (/ (- (exp x) 1) x) < 0.9877278429083478 or 1.753990269224867 < (/ (- (exp x) 1) x)
Initial program 0.3
\[\frac{e^{x} - 1}{x}\]
Taylor expanded around -inf 0.3
\[\leadsto \color{blue}{-1 \cdot \frac{1 - e^{x}}{x}}\]
Simplified0.3
\[\leadsto \color{blue}{\frac{e^{x} + -1}{x}}\]
if 0.9877278429083478 < (/ (- (exp x) 1) x) < 1.753990269224867
Initial program 23.3
\[\frac{e^{x} - 1}{x}\]
Taylor expanded around 0 6.4
\[\leadsto \color{blue}{\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)}\]
- Recombined 3 regimes into one program.
Final simplification0.3
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{e^{x} - 1}{x} \le 0.0:\\
\;\;\;\;\sqrt[3]{\left(\left(\left({x}^{2} \cdot \frac{1}{6} + 1\right) + \frac{1}{2} \cdot x\right) \cdot \left(\left({x}^{2} \cdot \frac{1}{6} + 1\right) + \frac{1}{2} \cdot x\right)\right) \cdot \left(\left({x}^{2} \cdot \frac{1}{6} + 1\right) + \frac{1}{2} \cdot x\right)}\\
\mathbf{elif}\;\frac{e^{x} - 1}{x} \le 0.9877278429083478:\\
\;\;\;\;\frac{-1 + e^{x}}{x}\\
\mathbf{elif}\;\frac{e^{x} - 1}{x} \le 1.753990269224867:\\
\;\;\;\;\left({x}^{2} \cdot \frac{1}{6} + 1\right) + \frac{1}{2} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 + e^{x}}{x}\\
\end{array}\]