| Alternative 1 | |
|---|---|
| Accuracy | 72.5% |
| Cost | 13568 |
\[\sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{-\frac{g}{a}}
\]
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 0.5 a) (- g g))) (/ (cbrt g) (cbrt (- a)))))
double code(double g, double h, double a) {
return cbrt(((1.0 / (2.0 * a)) * (-g + sqrt(((g * g) - (h * h)))))) + cbrt(((1.0 / (2.0 * a)) * (-g - sqrt(((g * g) - (h * h))))));
}
double code(double g, double h, double a) {
return cbrt(((0.5 / a) * (g - g))) + (cbrt(g) / cbrt(-a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((1.0 / (2.0 * a)) * (-g + Math.sqrt(((g * g) - (h * h)))))) + Math.cbrt(((1.0 / (2.0 * a)) * (-g - Math.sqrt(((g * g) - (h * h))))));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((0.5 / a) * (g - g))) + (Math.cbrt(g) / Math.cbrt(-a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(Float64(-g) + sqrt(Float64(Float64(g * g) - Float64(h * h)))))) + cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(Float64(-g) - sqrt(Float64(Float64(g * g) - Float64(h * h))))))) end
function code(g, h, a) return Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g - g))) + Float64(cbrt(g) / cbrt(Float64(-a)))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[((-g) + N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[((-g) - N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
code[g_, h_, a_] := N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[(-a), 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \frac{\sqrt[3]{g}}{\sqrt[3]{-a}}
Results
Initial program 43.6%
Simplified43.7%
[Start]43.6 | \[ \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\] |
|---|---|
+-commutative [=>]43.6 | \[ \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\sqrt{g \cdot g - h \cdot h} + \left(-g\right)\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\] |
associate-/r* [=>]43.7 | \[ \sqrt[3]{\color{blue}{\frac{\frac{1}{2}}{a}} \cdot \left(\sqrt{g \cdot g - h \cdot h} + \left(-g\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\] |
metadata-eval [=>]43.7 | \[ \sqrt[3]{\frac{\color{blue}{0.5}}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} + \left(-g\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\] |
unsub-neg [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \color{blue}{\left(\sqrt{g \cdot g - h \cdot h} - g\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\] |
sub-neg [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\left(-g\right) + \left(-\sqrt{g \cdot g - h \cdot h}\right)\right)}}
\] |
distribute-neg-out [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-\left(g + \sqrt{g \cdot g - h \cdot h}\right)\right)}}
\] |
neg-mul-1 [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-1 \cdot \left(g + \sqrt{g \cdot g - h \cdot h}\right)\right)}}
\] |
associate-*r* [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\color{blue}{\left(\frac{1}{2 \cdot a} \cdot -1\right) \cdot \left(g + \sqrt{g \cdot g - h \cdot h}\right)}}
\] |
*-commutative [<=]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\color{blue}{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \left(\frac{1}{2 \cdot a} \cdot -1\right)}}
\] |
associate-*l/ [=>]43.7 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \color{blue}{\frac{1 \cdot -1}{2 \cdot a}}}
\] |
Taylor expanded in g around inf 22.9%
Taylor expanded in g around inf 72.4%
Simplified72.4%
[Start]72.4 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{\left(2 \cdot g\right) \cdot \frac{-0.5}{a}}
\] |
|---|---|
count-2 [<=]72.4 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{\color{blue}{\left(g + g\right)} \cdot \frac{-0.5}{a}}
\] |
Taylor expanded in g around 0 72.5%
Simplified72.5%
[Start]72.5 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{-1 \cdot \frac{g}{a}}
\] |
|---|---|
mul-1-neg [=>]72.5 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{\color{blue}{-\frac{g}{a}}}
\] |
distribute-neg-frac [=>]72.5 | \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{\color{blue}{\frac{-g}{a}}}
\] |
Applied egg-rr95.6%
Final simplification95.6%
| Alternative 1 | |
|---|---|
| Accuracy | 72.5% |
| Cost | 13568 |
| Alternative 2 | |
|---|---|
| Accuracy | 3.0% |
| Cost | 6848 |
herbie shell --seed 2023122
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))