Average Error: 31.9 → 0.1
Time: 10.5s
Precision: binary64
Cost: 13376
\[\frac{1 - \cos x}{x \cdot x}\]
↓
\[\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}\]
\frac{1 - \cos x}{x \cdot x}↓
\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
↓
(FPCore (x) :precision binary64 (* (/ (tan (/ x 2.0)) x) (/ (sin x) x)))
double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
return (tan(x / 2.0) / x) * (sin(x) / x);
}
Try it out
Enter valid numbers for all inputs
Alternatives
| Alternative 1 |
|---|
| Error | 32.2 |
|---|
| Cost | 39872 |
|---|
\[\sqrt[3]{\frac{1 - \cos x}{x \cdot x}} \cdot \left(\sqrt[3]{\frac{1 - \cos x}{x \cdot x}} \cdot \sqrt[3]{\frac{1 - \cos x}{x \cdot x}}\right)\]
| Alternative 2 |
|---|
| Error | 0.7 |
|---|
| Cost | 39616 |
|---|
\[\sqrt{\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}} \cdot \sqrt{\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}}\]
| Alternative 3 |
|---|
| Error | 31.4 |
|---|
| Cost | 39360 |
|---|
\[\frac{\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}}{x} \cdot \frac{\sqrt[3]{1 - \cos x}}{x}\]
| Alternative 4 |
|---|
| Error | 15.9 |
|---|
| Cost | 39360 |
|---|
\[\frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x} \cdot \frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}\]
| Alternative 5 |
|---|
| Error | 31.6 |
|---|
| Cost | 39360 |
|---|
\[\frac{\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}}{\frac{x}{\frac{\sqrt[3]{1 - \cos x}}{x}}}\]
| Alternative 6 |
|---|
| Error | 32.0 |
|---|
| Cost | 26624 |
|---|
\[\frac{1 - {\cos x}^{3}}{\left(x \cdot x\right) \cdot \left(1 + \cos x \cdot \left(1 + \cos x\right)\right)}\]
| Alternative 7 |
|---|
| Error | 32.0 |
|---|
| Cost | 26624 |
|---|
\[\frac{\frac{1 - {\cos x}^{3}}{1 + \cos x \cdot \left(1 + \cos x\right)}}{x \cdot x}\]
| Alternative 8 |
|---|
| Error | 32.0 |
|---|
| Cost | 26560 |
|---|
\[\sqrt{\frac{1 - \cos x}{x \cdot x}} \cdot \sqrt{\frac{1 - \cos x}{x \cdot x}}\]
| Alternative 9 |
|---|
| Error | 47.2 |
|---|
| Cost | 26304 |
|---|
\[\frac{1 + \sqrt{\cos x}}{x} \cdot \frac{1 - \sqrt{\cos x}}{x}\]
| Alternative 10 |
|---|
| Error | 31.2 |
|---|
| Cost | 26304 |
|---|
\[\frac{\sqrt{1 - \cos x}}{x} \cdot \frac{\sqrt{1 - \cos x}}{x}\]
| Alternative 11 |
|---|
| Error | 32.0 |
|---|
| Cost | 26304 |
|---|
\[\frac{\sqrt{1 - \cos x} \cdot \sqrt{1 - \cos x}}{x \cdot x}\]
| Alternative 12 |
|---|
| Error | 47.3 |
|---|
| Cost | 26304 |
|---|
\[\frac{1 + \sqrt{\cos x}}{\frac{x}{\frac{1 - \sqrt{\cos x}}{x}}}\]
| Alternative 13 |
|---|
| Error | 31.5 |
|---|
| Cost | 26304 |
|---|
\[\frac{\sqrt{1 - \cos x}}{\frac{x}{\frac{\sqrt{1 - \cos x}}{x}}}\]
| Alternative 14 |
|---|
| Error | 32.1 |
|---|
| Cost | 20032 |
|---|
\[\frac{1 - \cos x \cdot \cos x}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}\]
| Alternative 15 |
|---|
| Error | 16.3 |
|---|
| Cost | 19904 |
|---|
\[\frac{\frac{\sin x \cdot \sin x}{1 + \cos x}}{x \cdot x}\]
| Alternative 16 |
|---|
| Error | 41.5 |
|---|
| Cost | 19712 |
|---|
\[\sqrt[3]{{\left(\frac{1 - \cos x}{x \cdot x}\right)}^{3}}\]
| Alternative 17 |
|---|
| Error | 32.0 |
|---|
| Cost | 19712 |
|---|
\[\frac{\sqrt[3]{{\left(1 - \cos x\right)}^{3}}}{x \cdot x}\]
| Alternative 18 |
|---|
| Error | 32.0 |
|---|
| Cost | 19648 |
|---|
\[\frac{\log \left(e^{1 - \cos x}\right)}{x \cdot x}\]
| Alternative 19 |
|---|
| Error | 0.1 |
|---|
| Cost | 13504 |
|---|
\[\frac{1}{\frac{x}{\sin x}} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}\]
| Alternative 20 |
|---|
| Error | 0.2 |
|---|
| Cost | 13504 |
|---|
\[\frac{1}{x} \cdot \left(\tan \left(\frac{x}{2}\right) \cdot \frac{\sin x}{x}\right)\]
| Alternative 21 |
|---|
| Error | 16.1 |
|---|
| Cost | 13504 |
|---|
\[\frac{\tan \left(\frac{x}{2}\right) \cdot \left(-\sin x\right)}{-x \cdot x}\]
| Alternative 22 |
|---|
| Error | 0.4 |
|---|
| Cost | 13376 |
|---|
\[\frac{\tan \left(\frac{x}{2}\right)}{x \cdot \frac{x}{\sin x}}\]
| Alternative 23 |
|---|
| Error | 16.1 |
|---|
| Cost | 13376 |
|---|
\[\frac{\tan \left(\frac{x}{2}\right) \cdot \sin x}{x \cdot x}\]
| Alternative 24 |
|---|
| Error | 0.1 |
|---|
| Cost | 13376 |
|---|
\[\frac{\tan \left(\frac{x}{2}\right) \cdot \frac{\sin x}{x}}{x}\]
| Alternative 25 |
|---|
| Error | 31.9 |
|---|
| Cost | 7104 |
|---|
\[\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}\]
| Alternative 26 |
|---|
| Error | 32.0 |
|---|
| Cost | 6976 |
|---|
\[\left(1 - \cos x\right) \cdot \frac{1}{x \cdot x}\]
| Alternative 27 |
|---|
| Error | 31.5 |
|---|
| Cost | 6976 |
|---|
\[\frac{1}{\frac{x}{\frac{1 - \cos x}{x}}}\]
| Alternative 28 |
|---|
| Error | 31.2 |
|---|
| Cost | 6976 |
|---|
\[\frac{1 - \cos x}{x} \cdot \frac{1}{x}\]
| Alternative 29 |
|---|
| Error | 31.9 |
|---|
| Cost | 6848 |
|---|
\[\frac{1 - \cos x}{x \cdot x}\]
| Alternative 30 |
|---|
| Error | 31.2 |
|---|
| Cost | 6848 |
|---|
\[\frac{\frac{1 - \cos x}{x}}{x}\]
| Alternative 31 |
|---|
| Error | 30.5 |
|---|
| Cost | 64 |
|---|
\[0.5\]
| Alternative 32 |
|---|
| Error | 56.6 |
|---|
| Cost | 64 |
|---|
\[1\]
| Alternative 33 |
|---|
| Error | 46.8 |
|---|
| Cost | 64 |
|---|
\[0\]
| Alternative 34 |
|---|
| Error | 62.6 |
|---|
| Cost | 64 |
|---|
\[-1\]
Error

Derivation
Initial program 31.9
\[\frac{1 - \cos x}{x \cdot x}\]
- Using strategy
rm Applied flip--_binary64_4632.1
\[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
Simplified16.3
\[\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{x \cdot x}\]
- Using strategy
rm Applied *-un-lft-identity_binary64_7116.3
\[\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{1 \cdot \left(1 + \cos x\right)}}}{x \cdot x}\]
Applied times-frac_binary64_7716.3
\[\leadsto \frac{\color{blue}{\frac{\sin x}{1} \cdot \frac{\sin x}{1 + \cos x}}}{x \cdot x}\]
Applied times-frac_binary64_770.3
\[\leadsto \color{blue}{\frac{\frac{\sin x}{1}}{x} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}}\]
Simplified0.3
\[\leadsto \color{blue}{\frac{\sin x}{x}} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}\]
Simplified0.1
\[\leadsto \frac{\sin x}{x} \cdot \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x}}\]
Simplified0.1
\[\leadsto \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}}\]
Final simplification0.1
\[\leadsto \frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}\]
Reproduce
herbie shell --seed 2021042
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))