- Split input into 2 regimes
if (+ (* x (pow eps 2)) (+ eps (* (pow x 2) (pow eps 3)))) < -1.059607752271381e-24 or 5.431768626105551e-126 < (+ (* x (pow eps 2)) (+ eps (* (pow x 2) (pow eps 3))))
Initial program 35.0
\[\tan \left(x + \varepsilon\right) - \tan x\]
- Using strategy
rm Applied tan-sum14.1
\[\leadsto \color{blue}{\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon}} - \tan x\]
- Using strategy
rm Applied add-cube-cbrt14.2
\[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \color{blue}{\left(\left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right) \cdot \sqrt[3]{\tan \varepsilon}\right)}} - \tan x\]
Applied associate-*r*14.2
\[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \color{blue}{\left(\tan x \cdot \left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right)\right) \cdot \sqrt[3]{\tan \varepsilon}}} - \tan x\]
- Using strategy
rm Applied tan-quot14.3
\[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \left(\tan x \cdot \left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right)\right) \cdot \sqrt[3]{\tan \varepsilon}} - \color{blue}{\frac{\sin x}{\cos x}}\]
Applied frac-sub14.3
\[\leadsto \color{blue}{\frac{\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \left(1 - \left(\tan x \cdot \left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right)\right) \cdot \sqrt[3]{\tan \varepsilon}\right) \cdot \sin x}{\left(1 - \left(\tan x \cdot \left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right)\right) \cdot \sqrt[3]{\tan \varepsilon}\right) \cdot \cos x}}\]
Simplified13.2
\[\leadsto \frac{\color{blue}{\left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right) + \left(\sin x \cdot \tan \varepsilon\right) \cdot \tan x}}{\left(1 - \left(\tan x \cdot \left(\sqrt[3]{\tan \varepsilon} \cdot \sqrt[3]{\tan \varepsilon}\right)\right) \cdot \sqrt[3]{\tan \varepsilon}\right) \cdot \cos x}\]
Simplified13.0
\[\leadsto \frac{\left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right) + \left(\sin x \cdot \tan \varepsilon\right) \cdot \tan x}{\color{blue}{\cos x - \tan x \cdot \left(\cos x \cdot \tan \varepsilon\right)}}\]
if -1.059607752271381e-24 < (+ (* x (pow eps 2)) (+ eps (* (pow x 2) (pow eps 3)))) < 5.431768626105551e-126
Initial program 42.3
\[\tan \left(x + \varepsilon\right) - \tan x\]
Taylor expanded around 0 16.9
\[\leadsto \color{blue}{x \cdot {\varepsilon}^{2} + \left(\varepsilon + {x}^{2} \cdot {\varepsilon}^{3}\right)}\]
- Recombined 2 regimes into one program.
Final simplification14.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;{\varepsilon}^{2} \cdot x + \left(\varepsilon + {\varepsilon}^{3} \cdot {x}^{2}\right) \le -1.059607752271381 \cdot 10^{-24}:\\
\;\;\;\;\frac{\tan x \cdot \left(\tan \varepsilon \cdot \sin x\right) + \left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right)}{\cos x - \left(\tan \varepsilon \cdot \cos x\right) \cdot \tan x}\\
\mathbf{elif}\;{\varepsilon}^{2} \cdot x + \left(\varepsilon + {\varepsilon}^{3} \cdot {x}^{2}\right) \le 5.431768626105551 \cdot 10^{-126}:\\
\;\;\;\;{\varepsilon}^{2} \cdot x + \left(\varepsilon + {\varepsilon}^{3} \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan x \cdot \left(\tan \varepsilon \cdot \sin x\right) + \left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right)}{\cos x - \left(\tan \varepsilon \cdot \cos x\right) \cdot \tan x}\\
\end{array}\]