2-ancestry mixing, positive discriminant

Percentage Accurate: 45.3% → 95.7%
Time: 6.6s
Alternatives: 3
Speedup: 3.9×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ \sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)} \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h)))))
   (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = sqrt(((g * g) - (h * h)));
	return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1))))
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 3 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 45.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ \sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)} \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h)))))
   (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = sqrt(((g * g) - (h * h)));
	return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1))))
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}

Alternative 1: 95.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \sqrt[3]{\frac{0.5}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot {2}^{0.3333333333333333}\right)\right) \end{array} \]
(FPCore (g h a)
 :precision binary64
 (* (cbrt (/ 0.5 a)) (* -1.0 (* (cbrt g) (pow 2.0 0.3333333333333333)))))
double code(double g, double h, double a) {
	return cbrt((0.5 / a)) * (-1.0 * (cbrt(g) * pow(2.0, 0.3333333333333333)));
}
public static double code(double g, double h, double a) {
	return Math.cbrt((0.5 / a)) * (-1.0 * (Math.cbrt(g) * Math.pow(2.0, 0.3333333333333333)));
}
function code(g, h, a)
	return Float64(cbrt(Float64(0.5 / a)) * Float64(-1.0 * Float64(cbrt(g) * (2.0 ^ 0.3333333333333333))))
end
code[g_, h_, a_] := N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[(-1.0 * N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[2.0, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{0.5}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot {2}^{0.3333333333333333}\right)\right)
\end{array}
Derivation
  1. Initial program 45.3%

    \[\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. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\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. lift-cbrt.f64N/A

      \[\leadsto \color{blue}{\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)} \]
    3. lift-*.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{\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)} \]
    4. cbrt-prodN/A

      \[\leadsto \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)} \]
    5. lift-cbrt.f64N/A

      \[\leadsto \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 \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
    6. lift-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) + \sqrt{g \cdot g - h \cdot h}} + \sqrt[3]{\color{blue}{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
    7. cbrt-prodN/A

      \[\leadsto \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}}} \]
    8. distribute-lft-outN/A

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

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

    \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \color{blue}{\left(-1 \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{2}\right)\right)} \]
  5. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \left(-1 \cdot \color{blue}{\left(\sqrt[3]{g} \cdot \sqrt[3]{2}\right)}\right) \]
    2. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{2}}\right)\right) \]
    3. lower-cbrt.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{\color{blue}{2}}\right)\right) \]
    4. lower-cbrt.f6495.3

      \[\leadsto \sqrt[3]{\frac{0.5}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{2}\right)\right) \]
  6. Applied rewrites95.3%

    \[\leadsto \sqrt[3]{\frac{0.5}{a}} \cdot \color{blue}{\left(-1 \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{2}\right)\right)} \]
  7. Step-by-step derivation
    1. lift-cbrt.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{2}\right)\right) \]
    2. pow1/3N/A

      \[\leadsto \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot {2}^{\color{blue}{\frac{1}{3}}}\right)\right) \]
    3. lower-pow.f6495.7

      \[\leadsto \sqrt[3]{\frac{0.5}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot {2}^{\color{blue}{0.3333333333333333}}\right)\right) \]
  8. Applied rewrites95.7%

    \[\leadsto \sqrt[3]{\frac{0.5}{a}} \cdot \left(-1 \cdot \left(\sqrt[3]{g} \cdot {2}^{\color{blue}{0.3333333333333333}}\right)\right) \]
  9. Add Preprocessing

Alternative 2: 95.7% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \frac{\sqrt[3]{g}}{-\sqrt[3]{a}} \end{array} \]
(FPCore (g h a) :precision binary64 (/ (cbrt g) (- (cbrt a))))
double code(double g, double h, double a) {
	return cbrt(g) / -cbrt(a);
}
public static double code(double g, double h, double a) {
	return Math.cbrt(g) / -Math.cbrt(a);
}
function code(g, h, a)
	return Float64(cbrt(g) / Float64(-cbrt(a)))
end
code[g_, h_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / (-N[Power[a, 1/3], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt[3]{g}}{-\sqrt[3]{a}}
\end{array}
Derivation
  1. Initial program 45.3%

    \[\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. Taylor expanded in g around inf

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\color{blue}{\sqrt[3]{a}}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{\color{blue}{a}}} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    5. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    6. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    7. lower-cbrt.f6495.0

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
  4. Applied rewrites95.0%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}}} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{\color{blue}{a}}} \]
    2. lift-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    3. pow1/3N/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    5. lift-cbrt.f64N/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    6. lift-cbrt.f64N/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    7. cbrt-unprodN/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \sqrt[3]{\frac{-1}{2} \cdot 2}}{\sqrt[3]{a}} \]
    8. metadata-evalN/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot \sqrt[3]{-1}}{\sqrt[3]{a}} \]
    9. pow1/3N/A

      \[\leadsto \frac{{g}^{\frac{1}{3}} \cdot {-1}^{\frac{1}{3}}}{\sqrt[3]{a}} \]
    10. pow-prod-downN/A

      \[\leadsto \frac{{\left(g \cdot -1\right)}^{\frac{1}{3}}}{\sqrt[3]{\color{blue}{a}}} \]
    11. *-commutativeN/A

      \[\leadsto \frac{{\left(-1 \cdot g\right)}^{\frac{1}{3}}}{\sqrt[3]{a}} \]
    12. mul-1-negN/A

      \[\leadsto \frac{{\left(\mathsf{neg}\left(g\right)\right)}^{\frac{1}{3}}}{\sqrt[3]{a}} \]
    13. lift-neg.f64N/A

      \[\leadsto \frac{{\left(-g\right)}^{\frac{1}{3}}}{\sqrt[3]{a}} \]
    14. pow1/3N/A

      \[\leadsto \frac{\sqrt[3]{-g}}{\sqrt[3]{\color{blue}{a}}} \]
    15. lift-neg.f64N/A

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\sqrt[3]{a}} \]
    16. mul-1-negN/A

      \[\leadsto \frac{\sqrt[3]{-1 \cdot g}}{\sqrt[3]{a}} \]
    17. *-commutativeN/A

      \[\leadsto \frac{\sqrt[3]{g \cdot -1}}{\sqrt[3]{a}} \]
    18. *-commutativeN/A

      \[\leadsto \frac{\sqrt[3]{-1 \cdot g}}{\sqrt[3]{a}} \]
    19. mul-1-negN/A

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\sqrt[3]{a}} \]
    20. cbrt-neg-revN/A

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt[3]{g}\right)}{\sqrt[3]{\color{blue}{a}}} \]
    21. lift-cbrt.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt[3]{g}\right)}{\sqrt[3]{a}} \]
    22. lower-neg.f6495.7

      \[\leadsto \frac{-\sqrt[3]{g}}{\sqrt[3]{\color{blue}{a}}} \]
  6. Applied rewrites95.7%

    \[\leadsto \frac{-\sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \]
  7. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{-\sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \]
    2. lift-neg.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt[3]{g}\right)}{\sqrt[3]{\color{blue}{a}}} \]
    3. distribute-frac-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}}\right) \]
    4. distribute-neg-frac2N/A

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    6. lower-neg.f6495.7

      \[\leadsto \frac{\sqrt[3]{g}}{-\sqrt[3]{a}} \]
  8. Applied rewrites95.7%

    \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{-\sqrt[3]{a}}} \]
  9. Add Preprocessing

Alternative 3: 73.9% accurate, 3.9× speedup?

\[\begin{array}{l} \\ -\sqrt[3]{\frac{g}{a}} \end{array} \]
(FPCore (g h a) :precision binary64 (- (cbrt (/ g a))))
double code(double g, double h, double a) {
	return -cbrt((g / a));
}
public static double code(double g, double h, double a) {
	return -Math.cbrt((g / a));
}
function code(g, h, a)
	return Float64(-cbrt(Float64(g / a)))
end
code[g_, h_, a_] := (-N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision])
\begin{array}{l}

\\
-\sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 45.3%

    \[\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. Taylor expanded in g around inf

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\color{blue}{\sqrt[3]{a}}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{\color{blue}{a}}} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    5. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    6. lower-cbrt.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
    7. lower-cbrt.f6495.0

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}} \]
  4. Applied rewrites95.0%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)}{\sqrt[3]{a}}} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\color{blue}{\sqrt[3]{a}}} \]
    2. frac-2negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    3. distribute-frac-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right) \]
    4. lower-neg.f64N/A

      \[\leadsto -\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    5. lift-*.f64N/A

      \[\leadsto -\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    6. lift-cbrt.f64N/A

      \[\leadsto -\frac{\sqrt[3]{g} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    7. pow1/3N/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    8. lift-*.f64N/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    9. lift-cbrt.f64N/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    10. lift-cbrt.f64N/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    11. cbrt-unprodN/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \sqrt[3]{\frac{-1}{2} \cdot 2}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    12. metadata-evalN/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot \sqrt[3]{-1}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    13. pow1/3N/A

      \[\leadsto -\frac{{g}^{\frac{1}{3}} \cdot {-1}^{\frac{1}{3}}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    14. pow-prod-downN/A

      \[\leadsto -\frac{{\left(g \cdot -1\right)}^{\frac{1}{3}}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    15. *-commutativeN/A

      \[\leadsto -\frac{{\left(-1 \cdot g\right)}^{\frac{1}{3}}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    16. mul-1-negN/A

      \[\leadsto -\frac{{\left(\mathsf{neg}\left(g\right)\right)}^{\frac{1}{3}}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    17. lift-neg.f64N/A

      \[\leadsto -\frac{{\left(-g\right)}^{\frac{1}{3}}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    18. pow1/3N/A

      \[\leadsto -\frac{\sqrt[3]{-g}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    19. lift-cbrt.f64N/A

      \[\leadsto -\frac{\sqrt[3]{-g}}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
    20. cbrt-neg-revN/A

      \[\leadsto -\frac{\sqrt[3]{-g}}{\sqrt[3]{\mathsf{neg}\left(a\right)}} \]
    21. cbrt-undivN/A

      \[\leadsto -\sqrt[3]{\frac{-g}{\mathsf{neg}\left(a\right)}} \]
    22. lift-neg.f64N/A

      \[\leadsto -\sqrt[3]{\frac{\mathsf{neg}\left(g\right)}{\mathsf{neg}\left(a\right)}} \]
    23. frac-2negN/A

      \[\leadsto -\sqrt[3]{\frac{g}{a}} \]
  6. Applied rewrites73.9%

    \[\leadsto -\sqrt[3]{\frac{g}{a}} \]
  7. Add Preprocessing

Reproduce

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