?

Average Error: 36.1 → 2.9
Time: 20.4s
Precision: binary64
Cost: 19776

?

\[\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(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right) \]
(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)) (+ (cbrt (* g -2.0)) (cbrt 0.0))))
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)) * (cbrt((g * -2.0)) + cbrt(0.0));
}
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)) * (Math.cbrt((g * -2.0)) + Math.cbrt(0.0));
}
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(0.5 / a)) * Float64(cbrt(Float64(g * -2.0)) + cbrt(0.0)))
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[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[(N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[0.0, 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(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 36.1

    \[\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)} \]
  2. Simplified32.3

    \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}} + \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}}\right)} \]
    Proof

    [Start]36.1

    \[ \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)} \]

    exponential-simplify-18 [=>]34.1

    \[ \color{blue}{\sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}} \cdot \sqrt[3]{\frac{1}{2 \cdot a}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]

    rational_best-simplify-2 [=>]34.1

    \[ \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]

    exponential-simplify-18 [=>]32.3

    \[ \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}} + \color{blue}{\sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}} \cdot \sqrt[3]{\frac{1}{2 \cdot a}}} \]

    rational_best-simplify-2 [=>]32.3

    \[ \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}} + \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}}} \]

    rational_best-simplify-47 [=>]32.3

    \[ \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}} + \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}}\right)} \]
  3. Taylor expanded in g around inf 47.6

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}} + \sqrt[3]{\left(-g\right) + \color{blue}{g}}\right) \]
  4. Taylor expanded in g around inf 2.9

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\color{blue}{-2 \cdot g}} + \sqrt[3]{\left(-g\right) + g}\right) \]
  5. Simplified2.9

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\color{blue}{g \cdot -2}} + \sqrt[3]{\left(-g\right) + g}\right) \]
    Proof

    [Start]2.9

    \[ \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{-2 \cdot g} + \sqrt[3]{\left(-g\right) + g}\right) \]

    rational_best-simplify-2 [<=]2.9

    \[ \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \left(\sqrt[3]{\color{blue}{g \cdot -2}} + \sqrt[3]{\left(-g\right) + g}\right) \]
  6. Applied egg-rr2.9

    \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{a + a}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right) + 0} \]
  7. Simplified2.9

    \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{a + a}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right)} \]
    Proof

    [Start]2.9

    \[ \sqrt[3]{\frac{1}{a + a}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right) + 0 \]

    rational_best-simplify-4 [=>]2.9

    \[ \color{blue}{\sqrt[3]{\frac{1}{a + a}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right)} \]
  8. Taylor expanded in a around 0 2.9

    \[\leadsto \sqrt[3]{\color{blue}{\frac{0.5}{a}}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right) \]
  9. Final simplification2.9

    \[\leadsto \sqrt[3]{\frac{0.5}{a}} \cdot \left(\sqrt[3]{g \cdot -2} + \sqrt[3]{0}\right) \]

Alternatives

Alternative 1
Error17.9
Cost13632
\[\sqrt[3]{\frac{0.5}{a} \cdot \left(\left(-g\right) + g\right)} + \sqrt[3]{-\frac{g}{a}} \]

Error

Reproduce?

herbie shell --seed 2023092 
(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))))))))