- Split input into 2 regimes
if x < -17835.962947013315 or 10615.219937138987 < x
Initial program 59.3
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
Taylor expanded around -inf 0.3
\[\leadsto \color{blue}{-\left(3 \cdot \frac{1}{{x}^{3}} + \left(\frac{1}{{x}^{2}} + 3 \cdot \frac{1}{x}\right)\right)}\]
Simplified0.0
\[\leadsto \color{blue}{(\left(\frac{\frac{-1}{x \cdot x}}{x}\right) \cdot 3 + \left(\frac{-1}{x \cdot x}\right))_* - \frac{3}{x}}\]
- Using strategy
rm Applied add-log-exp0.0
\[\leadsto (\left(\frac{\color{blue}{\log \left(e^{\frac{-1}{x \cdot x}}\right)}}{x}\right) \cdot 3 + \left(\frac{-1}{x \cdot x}\right))_* - \frac{3}{x}\]
if -17835.962947013315 < x < 10615.219937138987
Initial program 0.1
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
- Using strategy
rm Applied flip--0.1
\[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
Applied associate-/r/0.1
\[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
Applied flip-+0.1
\[\leadsto \frac{x}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
Applied associate-/r/0.1
\[\leadsto \color{blue}{\frac{x}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
Applied prod-diff0.1
\[\leadsto \color{blue}{(\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right))_* + (\left(-\left(x + 1\right)\right) \cdot \left(\frac{x + 1}{x \cdot x - 1 \cdot 1}\right) + \left(\left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right))_*}\]
Simplified0.1
\[\leadsto (\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\left(x + 1\right) \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right))_* + \color{blue}{0}\]
- Using strategy
rm Applied flip3-+0.1
\[\leadsto (\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\color{blue}{\frac{{x}^{3} + {1}^{3}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}} \cdot \frac{x + 1}{x \cdot x - 1 \cdot 1}\right))_* + 0\]
Applied frac-times0.1
\[\leadsto (\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\color{blue}{\frac{\left({x}^{3} + {1}^{3}\right) \cdot \left(x + 1\right)}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right) \cdot \left(x \cdot x - 1 \cdot 1\right)}}\right))_* + 0\]
Simplified0.1
\[\leadsto (\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\frac{\color{blue}{(x \cdot \left((\left(x \cdot x\right) \cdot x + 1)_*\right) + \left((\left(x \cdot x\right) \cdot x + 1)_*\right))_*}}{\left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right) \cdot \left(x \cdot x - 1 \cdot 1\right)}\right))_* + 0\]
Simplified0.1
\[\leadsto (\left(\frac{x}{x \cdot x - 1 \cdot 1}\right) \cdot \left(x - 1\right) + \left(-\frac{(x \cdot \left((\left(x \cdot x\right) \cdot x + 1)_*\right) + \left((\left(x \cdot x\right) \cdot x + 1)_*\right))_*}{\color{blue}{(\left(x \cdot x - x\right) \cdot \left((x \cdot x + -1)_*\right) + \left((x \cdot x + -1)_*\right))_*}}\right))_* + 0\]
- Recombined 2 regimes into one program.
Final simplification0.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \le -17835.962947013315:\\
\;\;\;\;(\left(\frac{\log \left(e^{\frac{-1}{x \cdot x}}\right)}{x}\right) \cdot 3 + \left(\frac{-1}{x \cdot x}\right))_* - \frac{3}{x}\\
\mathbf{elif}\;x \le 10615.219937138987:\\
\;\;\;\;(\left(\frac{x}{x \cdot x - 1}\right) \cdot \left(x - 1\right) + \left(-\frac{(x \cdot \left((\left(x \cdot x\right) \cdot x + 1)_*\right) + \left((\left(x \cdot x\right) \cdot x + 1)_*\right))_*}{(\left(x \cdot x - x\right) \cdot \left((x \cdot x + -1)_*\right) + \left((x \cdot x + -1)_*\right))_*}\right))_*\\
\mathbf{else}:\\
\;\;\;\;(\left(\frac{\log \left(e^{\frac{-1}{x \cdot x}}\right)}{x}\right) \cdot 3 + \left(\frac{-1}{x \cdot x}\right))_* - \frac{3}{x}\\
\end{array}\]