?

Average Accuracy: 43.7% → 97.0%
Time: 16.0s
Precision: binary64
Cost: 39744

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 43.7%

    \[\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. Simplified43.7%

    \[\leadsto \color{blue}{\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 \frac{-0.5}{a}}} \]
    Proof

    [Start]43.7

    \[ \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.7

    \[ \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}}} \]
  3. Taylor expanded in h around 0 11.9%

    \[\leadsto \sqrt[3]{\frac{0.5}{a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \color{blue}{{\left(\frac{1 \cdot g}{a}\right)}^{0.3333333333333333} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)} \]
  4. Simplified25.9%

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

    [Start]11.9

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

    *-commutative [=>]11.9

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

    associate-*l* [=>]11.9

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

    unpow1/3 [=>]25.9

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

    *-lft-identity [=>]25.9

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

    \[\leadsto \sqrt[3]{\frac{0.5}{a} \cdot \left(\color{blue}{\left(-0.5 \cdot \frac{{h}^{2}}{g} + g\right)} - g\right)} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \sqrt[3]{\frac{g}{a}}\right) \]
  6. Simplified72.2%

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

    [Start]68.8

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

    fma-def [=>]68.8

    \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\color{blue}{\mathsf{fma}\left(-0.5, \frac{{h}^{2}}{g}, g\right)} - g\right)} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \sqrt[3]{\frac{g}{a}}\right) \]

    unpow2 [=>]68.8

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

    associate-/l* [=>]72.2

    \[ \sqrt[3]{\frac{0.5}{a} \cdot \left(\mathsf{fma}\left(-0.5, \color{blue}{\frac{h}{\frac{g}{h}}}, g\right) - g\right)} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \sqrt[3]{\frac{g}{a}}\right) \]
  7. Applied egg-rr95.3%

    \[\leadsto \sqrt[3]{\frac{0.5}{a} \cdot \left(\mathsf{fma}\left(-0.5, \frac{h}{\frac{g}{h}}, g\right) - g\right)} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \color{blue}{\left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right)}\right) \]
  8. Applied egg-rr95.6%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\mathsf{fma}\left(-0.5, h \cdot \frac{h}{g}, g\right) - g\right) \cdot 0.5}}{\sqrt[3]{a}}} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right)\right) \]
  9. Simplified97.0%

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

    [Start]95.6

    \[ \frac{\sqrt[3]{\left(\mathsf{fma}\left(-0.5, h \cdot \frac{h}{g}, g\right) - g\right) \cdot 0.5}}{\sqrt[3]{a}} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right)\right) \]

    fma-udef [=>]95.6

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

    associate-+r- [<=]97.0

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

    +-commutative [<=]97.0

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

    +-inverses [=>]97.0

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

    +-lft-identity [=>]97.0

    \[ \frac{\sqrt[3]{\color{blue}{\left(-0.5 \cdot \left(h \cdot \frac{h}{g}\right)\right)} \cdot 0.5}}{\sqrt[3]{a}} + \sqrt[3]{-0.5} \cdot \left(\sqrt[3]{2} \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right)\right) \]
  10. Final simplification97.0%

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

Alternatives

Alternative 1
Accuracy96.2%
Cost20681
\[\begin{array}{l} t_0 := \frac{\sqrt[3]{-0.5 \cdot \left(g + g\right)}}{\sqrt[3]{a}}\\ \mathbf{if}\;g \leq -1 \cdot 10^{+65} \lor \neg \left(g \leq 5 \cdot 10^{+278}\right):\\ \;\;\;\;t_0 + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \sqrt[3]{\frac{-0.5}{a} \cdot \left(\left(h \cdot \frac{h}{g}\right) \cdot 0.5\right)}\\ \end{array} \]
Alternative 2
Accuracy96.0%
Cost20672
\[\frac{\sqrt[3]{-0.5 \cdot \left(g + g\right)}}{\sqrt[3]{a}} + \sqrt[3]{\left(g + \left(0.5 \cdot \frac{h}{\frac{g}{h}} - g\right)\right) \cdot \frac{-0.5}{a}} \]
Alternative 3
Accuracy95.7%
Cost20160
\[\frac{\sqrt[3]{-0.5 \cdot \left(g + g\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)} \]
Alternative 4
Accuracy72.6%
Cost13568
\[\sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} + \sqrt[3]{\frac{-g}{a}} \]
Alternative 5
Accuracy3.0%
Cost6848
\[\sqrt[3]{\frac{0.5}{a} \cdot \left(g - g\right)} \]

Error

Reproduce?

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