Average Error: 52.9 → 43.0
Time: 16.0s
Precision: 64
Internal Precision: 2368
${\left(\sin \left(x + y\right)\right)}^{2} - {\left(\sin \left(x - y\right)\right)}^{2}$
$\begin{array}{l} \mathbf{if}\;x \le -0.0001934065824733373:\\ \;\;\;\;\left(\sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \left(\sin x \cdot \cos \left(-y\right)\right)\right) - \left(\sin \left(-y\right) \cdot \cos x\right) \cdot \sin \left(x - y\right)\\ \mathbf{elif}\;x \le 0.021993730294846612:\\ \;\;\;\;y \cdot \left(4 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(y + x\right) \cdot \left(\sin y \cdot \cos x\right) + \left(\sin \left(y + x\right) \cdot \left(\sin x \cdot \cos y\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)\right)\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if x < -0.0001934065824733373

1. Initial program 60.9

${\left(\sin \left(x + y\right)\right)}^{2} - {\left(\sin \left(x - y\right)\right)}^{2}$
2. Initial simplification60.9

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)$
3. Using strategy rm
4. Applied sub-neg60.9

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \sin \color{blue}{\left(x + \left(-y\right)\right)}$
5. Applied sin-sum58.2

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \color{blue}{\left(\sin x \cdot \cos \left(-y\right) + \cos x \cdot \sin \left(-y\right)\right)}$
6. Applied distribute-rgt-in58.2

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \color{blue}{\left(\left(\sin x \cdot \cos \left(-y\right)\right) \cdot \sin \left(x - y\right) + \left(\cos x \cdot \sin \left(-y\right)\right) \cdot \sin \left(x - y\right)\right)}$
7. Applied associate--r+54.5

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

## if -0.0001934065824733373 < x < 0.021993730294846612

1. Initial program 44.7

${\left(\sin \left(x + y\right)\right)}^{2} - {\left(\sin \left(x - y\right)\right)}^{2}$
2. Initial simplification44.7

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)$
3. Taylor expanded around 0 31.3

$\leadsto \color{blue}{4 \cdot \left(x \cdot y\right)}$
4. Using strategy rm
5. Applied associate-*r*31.2

$\leadsto \color{blue}{\left(4 \cdot x\right) \cdot y}$

## if 0.021993730294846612 < x

1. Initial program 60.8

${\left(\sin \left(x + y\right)\right)}^{2} - {\left(\sin \left(x - y\right)\right)}^{2}$
2. Initial simplification60.8

$\leadsto \sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)$
3. Using strategy rm
4. Applied sin-sum57.9

$\leadsto \sin \left(y + x\right) \cdot \color{blue}{\left(\sin y \cdot \cos x + \cos y \cdot \sin x\right)} - \sin \left(x - y\right) \cdot \sin \left(x - y\right)$
5. Applied distribute-rgt-in57.9

$\leadsto \color{blue}{\left(\left(\sin y \cdot \cos x\right) \cdot \sin \left(y + x\right) + \left(\cos y \cdot \sin x\right) \cdot \sin \left(y + x\right)\right)} - \sin \left(x - y\right) \cdot \sin \left(x - y\right)$
6. Applied associate--l+54.3

$\leadsto \color{blue}{\left(\sin y \cdot \cos x\right) \cdot \sin \left(y + x\right) + \left(\left(\cos y \cdot \sin x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)\right)}$
3. Recombined 3 regimes into one program.
4. Final simplification43.0

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0001934065824733373:\\ \;\;\;\;\left(\sin \left(y + x\right) \cdot \sin \left(y + x\right) - \sin \left(x - y\right) \cdot \left(\sin x \cdot \cos \left(-y\right)\right)\right) - \left(\sin \left(-y\right) \cdot \cos x\right) \cdot \sin \left(x - y\right)\\ \mathbf{elif}\;x \le 0.021993730294846612:\\ \;\;\;\;y \cdot \left(4 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(y + x\right) \cdot \left(\sin y \cdot \cos x\right) + \left(\sin \left(y + x\right) \cdot \left(\sin x \cdot \cos y\right) - \sin \left(x - y\right) \cdot \sin \left(x - y\right)\right)\\ \end{array}$

# Runtime

Time bar (total: 16.0s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x y)
:name "sin(x+y)^2-sin(x-y)^2"
(- (pow (sin (+ x y)) 2) (pow (sin (- x y)) 2)))