Average Error: 39.8 → 0.9
Time: 33.0s
Precision: 64
Internal Precision: 2368
$\cos \left(x + e\right) - \cos x$
$\begin{array}{l} \mathbf{if}\;\left(\cos x \cdot \cos e - \sin x \cdot \sin e\right) - \cos x \le -0.03320848810827198:\\ \;\;\;\;\left(\cos x \cdot \cos e - \sin x \cdot \sin e\right) - \cos x\\ \mathbf{if}\;\left(\cos x \cdot \cos e - \sin x \cdot \sin e\right) - \cos x \le 4.69573932950656 \cdot 10^{-07}:\\ \;\;\;\;-2 \cdot \left(\sin \left(\frac{x + \left(e + x\right)}{2}\right) \cdot \sin \left(\frac{e}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos x \cdot \cos e - \sin x \cdot \sin e\right) - \cos x\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (- (- (* (cos x) (cos e)) (* (sin x) (sin e))) (cos x)) < -0.03320848810827198 or 4.69573932950656e-07 < (- (- (* (cos x) (cos e)) (* (sin x) (sin e))) (cos x))

1. Initial program 30.9

$\cos \left(x + e\right) - \cos x$
2. Using strategy rm
3. Applied cos-sum0.6

$\leadsto \color{blue}{\left(\cos x \cdot \cos e - \sin x \cdot \sin e\right)} - \cos x$

## if -0.03320848810827198 < (- (- (* (cos x) (cos e)) (* (sin x) (sin e))) (cos x)) < 4.69573932950656e-07

1. Initial program 47.7

$\cos \left(x + e\right) - \cos x$
2. Using strategy rm
3. Applied diff-cos36.6

$\leadsto \color{blue}{-2 \cdot \left(\sin \left(\frac{\left(x + e\right) - x}{2}\right) \cdot \sin \left(\frac{\left(x + e\right) + x}{2}\right)\right)}$
4. Applied simplify1.2

$\leadsto -2 \cdot \color{blue}{\left(\sin \left(\frac{x + \left(e + x\right)}{2}\right) \cdot \sin \left(\frac{e}{2}\right)\right)}$
3. Recombined 2 regimes into one program.

# Runtime

Time bar (total: 33.0s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x e)
:name "cos(x+e)-cos(x)"
(- (cos (+ x e)) (cos x)))