| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13376 |
\[\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
(FPCore (x) :precision binary64 (/ (/ (sin x) x) (/ x (tan (* x 0.5)))))
double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
double code(double x) {
return (sin(x) / x) / (x / tan((x * 0.5)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / (x * x)
end function
real(8) function code(x)
real(8), intent (in) :: x
code = (sin(x) / x) / (x / tan((x * 0.5d0)))
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / (x * x);
}
public static double code(double x) {
return (Math.sin(x) / x) / (x / Math.tan((x * 0.5)));
}
def code(x): return (1.0 - math.cos(x)) / (x * x)
def code(x): return (math.sin(x) / x) / (x / math.tan((x * 0.5)))
function code(x) return Float64(Float64(1.0 - cos(x)) / Float64(x * x)) end
function code(x) return Float64(Float64(sin(x) / x) / Float64(x / tan(Float64(x * 0.5)))) end
function tmp = code(x) tmp = (1.0 - cos(x)) / (x * x); end
function tmp = code(x) tmp = (sin(x) / x) / (x / tan((x * 0.5))); end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] / N[(x / N[Tan[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1 - \cos x}{x \cdot x}
\frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}}
Results
Initial program 51.4%
Applied egg-rr75.7%
[Start]51.4 | \[ \frac{1 - \cos x}{x \cdot x}
\] |
|---|---|
flip-- [=>]51.2 | \[ \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}
\] |
metadata-eval [=>]51.2 | \[ \frac{\frac{\color{blue}{1} - \cos x \cdot \cos x}{1 + \cos x}}{x \cdot x}
\] |
1-sub-cos [=>]75.8 | \[ \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{x \cdot x}
\] |
associate-/l* [=>]75.7 | \[ \frac{\color{blue}{\frac{\sin x}{\frac{1 + \cos x}{\sin x}}}}{x \cdot x}
\] |
Applied egg-rr99.8%
[Start]75.7 | \[ \frac{\frac{\sin x}{\frac{1 + \cos x}{\sin x}}}{x \cdot x}
\] |
|---|---|
associate-/r/ [=>]75.8 | \[ \frac{\color{blue}{\frac{\sin x}{1 + \cos x} \cdot \sin x}}{x \cdot x}
\] |
times-frac [=>]99.5 | \[ \color{blue}{\frac{\frac{\sin x}{1 + \cos x}}{x} \cdot \frac{\sin x}{x}}
\] |
hang-0p-tan [=>]99.8 | \[ \frac{\color{blue}{\tan \left(\frac{x}{2}\right)}}{x} \cdot \frac{\sin x}{x}
\] |
Applied egg-rr99.8%
[Start]99.8 | \[ \frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}
\] |
|---|---|
clear-num [=>]99.8 | \[ \color{blue}{\frac{1}{\frac{x}{\tan \left(\frac{x}{2}\right)}}} \cdot \frac{\sin x}{x}
\] |
associate-*l/ [=>]99.8 | \[ \color{blue}{\frac{1 \cdot \frac{\sin x}{x}}{\frac{x}{\tan \left(\frac{x}{2}\right)}}}
\] |
*-un-lft-identity [<=]99.8 | \[ \frac{\color{blue}{\frac{\sin x}{x}}}{\frac{x}{\tan \left(\frac{x}{2}\right)}}
\] |
div-inv [=>]99.8 | \[ \frac{\frac{\sin x}{x}}{\frac{x}{\tan \color{blue}{\left(x \cdot \frac{1}{2}\right)}}}
\] |
metadata-eval [=>]99.8 | \[ \frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot \color{blue}{0.5}\right)}}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13376 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 7113 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 7113 |
| Alternative 4 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 905 |
| Alternative 5 | |
|---|---|
| Accuracy | 78.2% |
| Cost | 704 |
| Alternative 6 | |
|---|---|
| Accuracy | 51.1% |
| Cost | 64 |
herbie shell --seed 2023133
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))