?

Average Error: 59.5 → 18.1
Time: 32.1s
Precision: binary64
Cost: 11076

?

\[\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 := D \cdot \frac{M}{d}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{\frac{2 \cdot d}{h \cdot \frac{\frac{D}{d}}{\frac{c0}{w}}}}{D \cdot \left(2 \cdot \frac{w}{c0}\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \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 (* D (/ M d))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (if (<=
        (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))
        INFINITY)
     (/ (/ (* 2.0 d) (* h (/ (/ D d) (/ c0 w)))) (* D (* 2.0 (/ w c0))))
     (* 0.25 (* h (* t_0 t_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 = D * (M / d);
	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	double tmp;
	if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
		tmp = ((2.0 * d) / (h * ((D / d) / (c0 / w)))) / (D * (2.0 * (w / c0)));
	} else {
		tmp = 0.25 * (h * (t_0 * t_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 = D * (M / d);
	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	double tmp;
	if (((c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
		tmp = ((2.0 * d) / (h * ((D / d) / (c0 / w)))) / (D * (2.0 * (w / c0)));
	} else {
		tmp = 0.25 * (h * (t_0 * t_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 = D * (M / d)
	t_1 = (c0 * (d * d)) / ((w * h) * (D * D))
	tmp = 0
	if ((c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf:
		tmp = ((2.0 * d) / (h * ((D / d) / (c0 / w)))) / (D * (2.0 * (w / c0)))
	else:
		tmp = 0.25 * (h * (t_0 * t_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(D * Float64(M / d))
	t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	tmp = 0.0
	if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf)
		tmp = Float64(Float64(Float64(2.0 * d) / Float64(h * Float64(Float64(D / d) / Float64(c0 / w)))) / Float64(D * Float64(2.0 * Float64(w / c0))));
	else
		tmp = Float64(0.25 * Float64(h * Float64(t_0 * t_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 = D * (M / d);
	t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = 0.0;
	if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf)
		tmp = ((2.0 * d) / (h * ((D / d) / (c0 / w)))) / (D * (2.0 * (w / c0)));
	else
		tmp = 0.25 * (h * (t_0 * t_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[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(N[(N[(2.0 * d), $MachinePrecision] / N[(h * N[(N[(D / d), $MachinePrecision] / N[(c0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(2.0 * N[(w / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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 := D \cdot \frac{M}{d}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{\frac{2 \cdot d}{h \cdot \frac{\frac{D}{d}}{\frac{c0}{w}}}}{D \cdot \left(2 \cdot \frac{w}{c0}\right)}\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 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))))) < +inf.0

    1. Initial program 42.1

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

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

      [Start]42.1

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

      times-frac [=>]47.3

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \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 [=>]49.7

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \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-/r* [=>]49.9

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, \frac{d \cdot d}{D \cdot D}, \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) \]

      times-frac [=>]50.8

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \color{blue}{\frac{d}{D} \cdot \frac{d}{D}}, \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) \]

      difference-of-squares [=>]50.8

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

      sub-neg [=>]50.8

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

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

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

      [Start]42.8

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

      times-frac [=>]44.5

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

      associate-*l/ [=>]41.7

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

      unpow2 [=>]41.7

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

      unpow2 [=>]41.7

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

      times-frac [=>]39.0

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

      associate-*r/ [=>]38.7

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

      associate-*l/ [<=]42.6

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

      associate-*l/ [<=]41.6

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

      associate-*r/ [<=]40.5

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

      unpow2 [<=]40.5

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

      associate-*r/ [=>]41.6

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

      associate-/l* [=>]40.4

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

      associate-/r/ [=>]42.6

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

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

      \[\leadsto \color{blue}{\frac{\frac{d \cdot 2}{\frac{w \cdot \frac{D}{d}}{\frac{c0}{h}}}}{\left(2 \cdot \frac{w}{c0}\right) \cdot D}} \]
    7. Applied egg-rr28.3

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

    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 64.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) \]
    2. Taylor expanded in c0 around -inf 63.0

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -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)} \]
    3. Simplified34.6

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

      [Start]63.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -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) \]

      fma-def [=>]63.0

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -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. Taylor expanded in c0 around 0 33.6

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    5. Simplified25.4

      \[\leadsto \color{blue}{0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)} \]
      Proof

      [Start]33.6

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

      associate-/l* [=>]33.6

      \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}} \]

      associate-/r/ [=>]33.6

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

      unpow2 [=>]33.6

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

      unpow2 [=>]33.6

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

      times-frac [=>]25.4

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

      unpow2 [<=]25.4

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

      unpow2 [=>]25.4

      \[ 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)\right) \]
    6. Applied egg-rr43.0

      \[\leadsto 0.25 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(\frac{D}{d} \cdot \left(M \cdot \sqrt{h}\right)\right)}^{2}\right)} - 1\right)} \]
    7. Simplified38.0

      \[\leadsto 0.25 \cdot \color{blue}{{\left(\frac{D}{d} \cdot \left(M \cdot \sqrt{h}\right)\right)}^{2}} \]
      Proof

      [Start]43.0

      \[ 0.25 \cdot \left(e^{\mathsf{log1p}\left({\left(\frac{D}{d} \cdot \left(M \cdot \sqrt{h}\right)\right)}^{2}\right)} - 1\right) \]

      expm1-def [=>]38.2

      \[ 0.25 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{D}{d} \cdot \left(M \cdot \sqrt{h}\right)\right)}^{2}\right)\right)} \]

      expm1-log1p [=>]38.0

      \[ 0.25 \cdot \color{blue}{{\left(\frac{D}{d} \cdot \left(M \cdot \sqrt{h}\right)\right)}^{2}} \]
    8. Applied egg-rr15.5

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\left(D \cdot \frac{M}{d}\right) \cdot \left(D \cdot \frac{M}{d}\right)\right) \cdot h\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification18.1

    \[\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 \infty:\\ \;\;\;\;\frac{\frac{2 \cdot d}{h \cdot \frac{\frac{D}{d}}{\frac{c0}{w}}}}{D \cdot \left(2 \cdot \frac{w}{c0}\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error19.9
Cost2004
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ t_1 := 0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \mathbf{if}\;M \leq -2 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-164}:\\ \;\;\;\;0.25 \cdot \left(M \cdot \frac{\frac{D}{d} \cdot \left(h \cdot M\right)}{\frac{d}{D}}\right)\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 1.9 \cdot 10^{+143}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{h}{\frac{\frac{d}{D}}{M \cdot M}}\right)\\ \mathbf{elif}\;M \leq 8.2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\frac{2 \cdot d}{\left(D \cdot \frac{w}{c0}\right) \cdot \frac{h}{d}}}{D \cdot \left(2 \cdot \frac{w}{c0}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error19.9
Cost1225
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;M \leq 2 \cdot 10^{-141} \lor \neg \left(M \leq 4.8 \cdot 10^{+112}\right):\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \left(h \cdot M\right)\right)\right)\\ \end{array} \]
Alternative 3
Error19.7
Cost1225
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;M \leq 5 \cdot 10^{-159} \lor \neg \left(M \leq 1.25 \cdot 10^{+143}\right):\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{h}{\frac{\frac{d}{D}}{M \cdot M}}\right)\\ \end{array} \]
Alternative 4
Error20.2
Cost1225
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;D \leq -1.55 \cdot 10^{-177} \lor \neg \left(D \leq 0.0045\right):\\ \;\;\;\;0.25 \cdot \left(M \cdot \frac{\frac{D}{d} \cdot \left(h \cdot M\right)}{\frac{d}{D}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \end{array} \]
Alternative 5
Error20.5
Cost1092
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ \mathbf{if}\;D \leq 6 \cdot 10^{-5}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{M \cdot \left(h \cdot M\right)}{\frac{d}{D}}\right)\\ \end{array} \]
Alternative 6
Error20.3
Cost960
\[\begin{array}{l} t_0 := D \cdot \frac{M}{d}\\ 0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right) \end{array} \]
Alternative 7
Error32.0
Cost64
\[0 \]

Error

Reproduce?

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