?

Average Error: 92.81% → 45.01%
Time: 33.7s
Precision: binary64
Cost: 30284

?

\[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
\[\begin{array}{l} t_0 := \frac{w \cdot D}{d}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_2 := \frac{c0}{2 \cdot w} \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\ \mathbf{if}\;t_2 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;\frac{c0}{h} \cdot \left(\frac{c0}{w} \cdot \frac{\frac{d}{D}}{t_0}\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\frac{\frac{M \cdot \left(\left(c0 \cdot M\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{d \cdot \frac{c0}{D}}}}{h} + \frac{d \cdot d}{D \cdot D} \cdot \frac{c0}{w \cdot h}}\right)}{w}}{2}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;\frac{c0}{t_0} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (*
  (/ c0 (* 2.0 w))
  (+
   (/ (* c0 (* d d)) (* (* w h) (* D D)))
   (sqrt
    (-
     (*
      (/ (* c0 (* d d)) (* (* w h) (* D D)))
      (/ (* c0 (* d d)) (* (* w h) (* D D))))
     (* M M))))))
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* w D) d))
        (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
        (t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
   (if (<= t_2 -1e-304)
     (* (/ c0 h) (* (/ c0 w) (/ (/ d D) t_0)))
     (if (<= t_2 0.0)
       (/
        (/
         (*
          M
          (*
           (* c0 M)
           (/
            1.0
            (+
             (/ (/ (/ d w) (/ D (* d (/ c0 D)))) h)
             (* (/ (* d d) (* D D)) (/ c0 (* w h)))))))
         w)
        2.0)
       (if (<= t_2 INFINITY) (* (/ c0 t_0) (* (/ d D) (/ (/ c0 h) w))) 0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (w * D) / d;
	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
	double tmp;
	if (t_2 <= -1e-304) {
		tmp = (c0 / h) * ((c0 / w) * ((d / D) / t_0));
	} else if (t_2 <= 0.0) {
		tmp = ((M * ((c0 * M) * (1.0 / ((((d / w) / (D / (d * (c0 / D)))) / h) + (((d * d) / (D * D)) * (c0 / (w * h))))))) / w) / 2.0;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = (c0 / t_0) * ((d / D) * ((c0 / h) / w));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (w * D) / d;
	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	double t_2 = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
	double tmp;
	if (t_2 <= -1e-304) {
		tmp = (c0 / h) * ((c0 / w) * ((d / D) / t_0));
	} else if (t_2 <= 0.0) {
		tmp = ((M * ((c0 * M) * (1.0 / ((((d / w) / (D / (d * (c0 / D)))) / h) + (((d * d) / (D * D)) * (c0 / (w * h))))))) / w) / 2.0;
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = (c0 / t_0) * ((d / D) * ((c0 / h) / w));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))))
def code(c0, w, h, D, d, M):
	t_0 = (w * D) / d
	t_1 = (c0 * (d * d)) / ((w * h) * (D * D))
	t_2 = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))
	tmp = 0
	if t_2 <= -1e-304:
		tmp = (c0 / h) * ((c0 / w) * ((d / D) / t_0))
	elif t_2 <= 0.0:
		tmp = ((M * ((c0 * M) * (1.0 / ((((d / w) / (D / (d * (c0 / D)))) / h) + (((d * d) / (D * D)) * (c0 / (w * h))))))) / w) / 2.0
	elif t_2 <= math.inf:
		tmp = (c0 / t_0) * ((d / D) * ((c0 / h) / w))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M)))))
end
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(w * D) / d)
	t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M)))))
	tmp = 0.0
	if (t_2 <= -1e-304)
		tmp = Float64(Float64(c0 / h) * Float64(Float64(c0 / w) * Float64(Float64(d / D) / t_0)));
	elseif (t_2 <= 0.0)
		tmp = Float64(Float64(Float64(M * Float64(Float64(c0 * M) * Float64(1.0 / Float64(Float64(Float64(Float64(d / w) / Float64(D / Float64(d * Float64(c0 / D)))) / h) + Float64(Float64(Float64(d * d) / Float64(D * D)) * Float64(c0 / Float64(w * h))))))) / w) / 2.0);
	elseif (t_2 <= Inf)
		tmp = Float64(Float64(c0 / t_0) * Float64(Float64(d / D) * Float64(Float64(c0 / h) / w)));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp = code(c0, w, h, D, d, M)
	tmp = (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (w * D) / d;
	t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
	tmp = 0.0;
	if (t_2 <= -1e-304)
		tmp = (c0 / h) * ((c0 / w) * ((d / D) / t_0));
	elseif (t_2 <= 0.0)
		tmp = ((M * ((c0 * M) * (1.0 / ((((d / w) / (D / (d * (c0 / D)))) / h) + (((d * d) / (D * D)) * (c0 / (w * h))))))) / w) / 2.0;
	elseif (t_2 <= Inf)
		tmp = (c0 / t_0) * ((d / D) * ((c0 / h) / w));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(w * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-304], N[(N[(c0 / h), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[(M * N[(N[(c0 * M), $MachinePrecision] * N[(1.0 / N[(N[(N[(N[(d / w), $MachinePrecision] / N[(D / N[(d * N[(c0 / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] + N[(N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(c0 / t$95$0), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
t_0 := \frac{w \cdot D}{d}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;\frac{c0}{h} \cdot \left(\frac{c0}{w} \cdot \frac{\frac{d}{D}}{t_0}\right)\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{\frac{M \cdot \left(\left(c0 \cdot M\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{d \cdot \frac{c0}{D}}}}{h} + \frac{d \cdot d}{D \cdot D} \cdot \frac{c0}{w \cdot h}}\right)}{w}}{2}\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{c0}{t_0} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -9.99999999999999971e-305

    1. Initial program 74.35

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around inf 83.62

      \[\leadsto \color{blue}{\frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}} \]
    3. Simplified75.89

      \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}} \]
      Proof

      [Start]83.62

      \[ \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \]

      times-frac [=>]84.65

      \[ \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}} \]

      unpow2 [=>]84.65

      \[ \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      unpow2 [=>]84.65

      \[ \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-/r* [=>]82.3

      \[ \color{blue}{\frac{\frac{d \cdot d}{D}}{D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-*r/ [<=]81.71

      \[ \frac{\color{blue}{d \cdot \frac{d}{D}}}{D} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-*l/ [<=]80.44

      \[ \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      unpow2 [=>]80.44

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\color{blue}{c0 \cdot c0}}{{w}^{2} \cdot h} \]

      associate-/l* [=>]75.89

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \color{blue}{\frac{c0}{\frac{{w}^{2} \cdot h}{c0}}} \]

      *-commutative [=>]75.89

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{\color{blue}{h \cdot {w}^{2}}}{c0}} \]

      unpow2 [=>]75.89

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \color{blue}{\left(w \cdot w\right)}}{c0}} \]
    4. Applied egg-rr61.54

      \[\leadsto \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \color{blue}{\left(\frac{c0}{h \cdot w} \cdot \frac{c0}{w}\right)} \]
    5. Applied egg-rr59.06

      \[\leadsto \color{blue}{\frac{\frac{c0}{w} \cdot \frac{c0}{h}}{\frac{D}{d} \cdot \left(\frac{D}{d} \cdot w\right)}} \]
    6. Applied egg-rr62.08

      \[\leadsto \color{blue}{\frac{c0}{h} \cdot \left(\frac{c0}{w} \cdot \frac{\frac{d}{D}}{\frac{w \cdot D}{d}}\right)} \]

    if -9.99999999999999971e-305 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 0.0

    1. Initial program 44.68

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Applied egg-rr56.31

      \[\leadsto \color{blue}{\frac{c0 \cdot \left(\left({\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - {\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2}\right) + M \cdot M\right)}{\left(w \cdot 2\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{{\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - M \cdot M}\right)}} \]
    3. Simplified48.41

      \[\leadsto \color{blue}{\frac{M \cdot M + 0}{\frac{\frac{d}{w} \cdot \frac{d \cdot c0}{D \cdot D}}{h} - \sqrt{{\left(\frac{\frac{d}{w} \cdot \frac{d \cdot c0}{D \cdot D}}{h}\right)}^{2} - M \cdot M}} \cdot \frac{c0}{2 \cdot w}} \]
      Proof

      [Start]56.31

      \[ \frac{c0 \cdot \left(\left({\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - {\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2}\right) + M \cdot M\right)}{\left(w \cdot 2\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{{\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - M \cdot M}\right)} \]

      times-frac [=>]53.6

      \[ \color{blue}{\frac{c0}{w \cdot 2} \cdot \frac{\left({\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - {\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2}\right) + M \cdot M}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{{\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - M \cdot M}}} \]

      *-commutative [<=]53.6

      \[ \color{blue}{\frac{\left({\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - {\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2}\right) + M \cdot M}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{{\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)}^{2} - M \cdot M}} \cdot \frac{c0}{w \cdot 2}} \]
    4. Applied egg-rr46.39

      \[\leadsto \color{blue}{\frac{\frac{\frac{\left(M \cdot M\right) \cdot c0}{\frac{\frac{d}{w}}{h \cdot \left(\frac{D}{c0} \cdot \frac{D}{d}\right)} - \sqrt{{\left(\frac{\frac{d}{w}}{h \cdot \left(\frac{D}{c0} \cdot \frac{D}{d}\right)}\right)}^{2} - M \cdot M}}}{w}}{2}} \]
    5. Applied egg-rr42.66

      \[\leadsto \frac{\frac{\color{blue}{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \sqrt{{\left(\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h}\right)}^{2} - M \cdot M}}\right)}}{w}}{2} \]
    6. Taylor expanded in c0 around -inf 35.72

      \[\leadsto \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \color{blue}{-1 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}}}\right)}{w}}{2} \]
    7. Simplified44.25

      \[\leadsto \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \color{blue}{\frac{d \cdot d}{D \cdot D} \cdot \left(-\frac{c0}{w \cdot h}\right)}}\right)}{w}}{2} \]
      Proof

      [Start]35.72

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - -1 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}}\right)}{w}}{2} \]

      mul-1-neg [=>]35.72

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \color{blue}{\left(-\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}}\right)}{w}}{2} \]

      times-frac [=>]44.25

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \left(-\color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}}\right)}\right)}{w}}{2} \]

      distribute-rgt-neg-in [=>]44.25

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \left(-\frac{c0}{w \cdot h}\right)}}\right)}{w}}{2} \]

      unpow2 [=>]44.25

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \left(-\frac{c0}{w \cdot h}\right)}\right)}{w}}{2} \]

      unpow2 [=>]44.25

      \[ \frac{\frac{M \cdot \left(\left(M \cdot c0\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{\frac{c0}{D} \cdot d}}}{h} - \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \left(-\frac{c0}{w \cdot h}\right)}\right)}{w}}{2} \]

    if 0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 74.62

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around inf 84.44

      \[\leadsto \color{blue}{\frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}} \]
    3. Simplified78.36

      \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}} \]
      Proof

      [Start]84.44

      \[ \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \]

      times-frac [=>]85.08

      \[ \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}} \]

      unpow2 [=>]85.08

      \[ \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      unpow2 [=>]85.08

      \[ \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-/r* [=>]83.34

      \[ \color{blue}{\frac{\frac{d \cdot d}{D}}{D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-*r/ [<=]81.57

      \[ \frac{\color{blue}{d \cdot \frac{d}{D}}}{D} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      associate-*l/ [<=]80.82

      \[ \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]

      unpow2 [=>]80.82

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\color{blue}{c0 \cdot c0}}{{w}^{2} \cdot h} \]

      associate-/l* [=>]78.36

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \color{blue}{\frac{c0}{\frac{{w}^{2} \cdot h}{c0}}} \]

      *-commutative [=>]78.36

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{\color{blue}{h \cdot {w}^{2}}}{c0}} \]

      unpow2 [=>]78.36

      \[ \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \color{blue}{\left(w \cdot w\right)}}{c0}} \]
    4. Applied egg-rr63.81

      \[\leadsto \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \color{blue}{\left(\frac{c0}{h \cdot w} \cdot \frac{c0}{w}\right)} \]
    5. Applied egg-rr62.54

      \[\leadsto \color{blue}{\frac{\frac{c0}{w} \cdot \frac{c0}{h}}{\frac{D}{d} \cdot \left(\frac{D}{d} \cdot w\right)}} \]
    6. Applied egg-rr46.46

      \[\leadsto \color{blue}{\frac{c0}{\frac{w \cdot D}{d}} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)} \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 100

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified99.84

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot {\left(\frac{d}{D}\right)}^{3}\right), -M \cdot M\right)}\right)} \]
      Proof

      [Start]100

      \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]

      associate-*l/ [<=]100

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \left(d \cdot d\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]

      *-commutative [=>]100

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]

      fma-def [=>]100

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
    3. Taylor expanded in c0 around -inf 98.07

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    4. Simplified51.32

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot 0\right)} \]
      Proof

      [Start]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \left(-1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]

      mul-1-neg [=>]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)} \]

      *-commutative [=>]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]

      distribute-rgt-neg-in [=>]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot \left(-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right)\right)} \]

      distribute-rgt1-in [=>]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(-\color{blue}{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}}\right)\right) \]

      metadata-eval [=>]98.07

      \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(-\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \]

      mul0-lft [=>]51.32

      \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(-\color{blue}{0}\right)\right) \]

      metadata-eval [=>]51.32

      \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
    5. Taylor expanded in c0 around 0 43.64

      \[\leadsto \color{blue}{0} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification45.01

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq -1 \cdot 10^{-304}:\\ \;\;\;\;\frac{c0}{h} \cdot \left(\frac{c0}{w} \cdot \frac{\frac{d}{D}}{\frac{w \cdot D}{d}}\right)\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq 0:\\ \;\;\;\;\frac{\frac{M \cdot \left(\left(c0 \cdot M\right) \cdot \frac{1}{\frac{\frac{\frac{d}{w}}{\frac{D}{d \cdot \frac{c0}{D}}}}{h} + \frac{d \cdot d}{D \cdot D} \cdot \frac{c0}{w \cdot h}}\right)}{w}}{2}\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{\frac{w \cdot D}{d}} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternatives

Alternative 1
Error50.66%
Cost1928
\[\begin{array}{l} \mathbf{if}\;d \cdot d \leq 2 \cdot 10^{-201}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h \cdot \frac{w}{c0}}\\ \mathbf{elif}\;d \cdot d \leq 10^{-75}:\\ \;\;\;\;\frac{\frac{\left(-M\right) \cdot \frac{M}{\frac{d \cdot d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot -2}}{w}}{2}\\ \mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{-52}:\\ \;\;\;\;\frac{c0}{\frac{w \cdot D}{d}} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 2
Error50.81%
Cost1608
\[\begin{array}{l} \mathbf{if}\;d \leq -88:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq -3.5 \cdot 10^{-230}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{\frac{d}{w} \cdot \frac{c0}{\frac{D}{d}}}{D}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 3
Error50.82%
Cost1352
\[\begin{array}{l} \mathbf{if}\;d \leq -4.2 \cdot 10^{-104}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-124}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot \frac{h}{\frac{c0}{w}}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 4
Error51.16%
Cost1352
\[\begin{array}{l} \mathbf{if}\;d \leq -4.5 \cdot 10^{-63}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq 9 \cdot 10^{-124}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h \cdot \frac{w}{c0}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 5
Error53.02%
Cost1352
\[\begin{array}{l} \mathbf{if}\;d \leq -4.4 \cdot 10^{+27}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-124}:\\ \;\;\;\;\frac{c0}{\frac{w \cdot D}{d}} \cdot \left(\frac{d}{D} \cdot \frac{\frac{c0}{h}}{w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 6
Error49.42%
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023125 
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  :precision binary64
  (* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))