- Split input into 2 regimes
if (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) < 8.4395697880213e-6
Initial program 58.9
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
- Using strategy
rm Applied add-log-exp58.9
\[\leadsto \frac{x}{x + 1} - \color{blue}{\log \left(e^{\frac{x + 1}{x - 1}}\right)}\]
Applied add-log-exp58.9
\[\leadsto \color{blue}{\log \left(e^{\frac{x}{x + 1}}\right)} - \log \left(e^{\frac{x + 1}{x - 1}}\right)\]
Applied diff-log58.9
\[\leadsto \color{blue}{\log \left(\frac{e^{\frac{x}{x + 1}}}{e^{\frac{x + 1}{x - 1}}}\right)}\]
Simplified58.9
\[\leadsto \log \color{blue}{\left(e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}\right)}\]
Taylor expanded around inf 0.6
\[\leadsto \color{blue}{-\left(1 \cdot \frac{1}{{x}^{2}} + \left(3 \cdot \frac{1}{x} + 3 \cdot \frac{1}{{x}^{3}}\right)\right)}\]
Simplified0.3
\[\leadsto \color{blue}{-\left(\frac{3}{x} + \frac{1 + \frac{3}{x}}{x \cdot x}\right)}\]
if 8.4395697880213e-6 < (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0)))
Initial program 0.1
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
- Using strategy
rm Applied div-inv0.1
\[\leadsto \color{blue}{x \cdot \frac{1}{x + 1}} - \frac{x + 1}{x - 1}\]
- Recombined 2 regimes into one program.
Final simplification0.2
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 8.4395697880213 \cdot 10^{-6}:\\
\;\;\;\;-\left(\frac{3}{x} + \frac{1 + \frac{3}{x}}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{x + 1} - \frac{x + 1}{x - 1}\\
\end{array}\]