?

Average Error: 59.6 → 18.5
Time: 34.1s
Precision: binary64
Cost: 20484

?

\[\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} \mathbf{if}\;h \leq -4.5 \cdot 10^{+152}:\\ \;\;\;\;0.25 \cdot \left(\left(D \cdot \left(\frac{M}{d} \cdot \frac{h}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt[3]{D} \cdot {\left(\sqrt[3]{D}\right)}^{2}\right)\right)\\ \mathbf{elif}\;h \leq 3 \cdot 10^{-285}:\\ \;\;\;\;0.25 \cdot \left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{M \cdot \left(D \cdot \sqrt{h}\right)}{\frac{d}{0.5}}\right)}^{2}\\ \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
 (if (<= h -4.5e+152)
   (* 0.25 (* (* D (* (/ M d) (/ h (/ d M)))) (* (cbrt D) (pow (cbrt D) 2.0))))
   (if (<= h 3e-285)
     (* 0.25 (* (/ (* h M) (/ d D)) (* D (/ M d))))
     (pow (/ (* M (* D (sqrt h))) (/ d 0.5)) 2.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 tmp;
	if (h <= -4.5e+152) {
		tmp = 0.25 * ((D * ((M / d) * (h / (d / M)))) * (cbrt(D) * pow(cbrt(D), 2.0)));
	} else if (h <= 3e-285) {
		tmp = 0.25 * (((h * M) / (d / D)) * (D * (M / d)));
	} else {
		tmp = pow(((M * (D * sqrt(h))) / (d / 0.5)), 2.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 tmp;
	if (h <= -4.5e+152) {
		tmp = 0.25 * ((D * ((M / d) * (h / (d / M)))) * (Math.cbrt(D) * Math.pow(Math.cbrt(D), 2.0)));
	} else if (h <= 3e-285) {
		tmp = 0.25 * (((h * M) / (d / D)) * (D * (M / d)));
	} else {
		tmp = Math.pow(((M * (D * Math.sqrt(h))) / (d / 0.5)), 2.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)
	tmp = 0.0
	if (h <= -4.5e+152)
		tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M / d) * Float64(h / Float64(d / M)))) * Float64(cbrt(D) * (cbrt(D) ^ 2.0))));
	elseif (h <= 3e-285)
		tmp = Float64(0.25 * Float64(Float64(Float64(h * M) / Float64(d / D)) * Float64(D * Float64(M / d))));
	else
		tmp = Float64(Float64(M * Float64(D * sqrt(h))) / Float64(d / 0.5)) ^ 2.0;
	end
	return 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_] := If[LessEqual[h, -4.5e+152], N[(0.25 * N[(N[(D * N[(N[(M / d), $MachinePrecision] * N[(h / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[D, 1/3], $MachinePrecision] * N[Power[N[Power[D, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3e-285], N[(0.25 * N[(N[(N[(h * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(M * N[(D * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $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}
\mathbf{if}\;h \leq -4.5 \cdot 10^{+152}:\\
\;\;\;\;0.25 \cdot \left(\left(D \cdot \left(\frac{M}{d} \cdot \frac{h}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt[3]{D} \cdot {\left(\sqrt[3]{D}\right)}^{2}\right)\right)\\

\mathbf{elif}\;h \leq 3 \cdot 10^{-285}:\\
\;\;\;\;0.25 \cdot \left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{M \cdot \left(D \cdot \sqrt{h}\right)}{\frac{d}{0.5}}\right)}^{2}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if h < -4.5000000000000001e152

    1. Initial program 61.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. Simplified61.2

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

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

      times-frac [=>]61.8

      \[ \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-neg [=>]61.8

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

      times-frac [=>]61.6

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

      times-frac [=>]61.2

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

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

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

      [Start]60.8

      \[ -0.5 \cdot \frac{\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}^{2}}{w} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \]
    5. Taylor expanded in w around 0 35.0

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

      \[\leadsto 0 + 0.25 \cdot \color{blue}{\left(\frac{\frac{M \cdot \left(h \cdot M\right)}{\frac{d}{D}}}{\frac{d}{{\left(\sqrt[3]{D}\right)}^{2}}} \cdot \sqrt[3]{D}\right)} \]
    7. Simplified23.6

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

      [Start]30.1

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

      associate-/r/ [=>]31.4

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

      associate-*l* [=>]31.4

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

      associate-/r/ [=>]31.7

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

      associate-*l/ [<=]33.2

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

      associate-/r* [<=]35.3

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

      *-commutative [=>]35.3

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

      times-frac [=>]30.7

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

      associate-/l* [=>]23.6

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

    if -4.5000000000000001e152 < h < 3.00000000000000003e-285

    1. Initial program 59.4

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

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

      [Start]59.4

      \[ \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 [=>]60.5

      \[ \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-neg [=>]60.5

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

      times-frac [=>]60.3

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

      times-frac [=>]59.1

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

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

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

      [Start]60.5

      \[ -0.5 \cdot \frac{\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}^{2}}{w} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \]
    5. Taylor expanded in w around 0 27.0

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

      \[\leadsto 0 + 0.25 \cdot \color{blue}{\left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(\frac{M}{d} \cdot D\right)\right)} \]

    if 3.00000000000000003e-285 < h

    1. Initial program 59.6

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

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

      [Start]59.6

      \[ \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 [=>]60.4

      \[ \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-neg [=>]60.4

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

      times-frac [=>]60.3

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

      times-frac [=>]59.2

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

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

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

      [Start]60.2

      \[ -0.5 \cdot \frac{\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}^{2}}{w} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \]
    5. Taylor expanded in w around 0 29.3

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

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

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

      [Start]28.0

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

      expm1-def [=>]18.8

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

      expm1-log1p [=>]18.4

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

      metadata-eval [<=]18.4

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

      unpow2 [=>]18.4

      \[ 0 + \left(0.5 \cdot 0.5\right) \cdot \color{blue}{\left(\left(\frac{M \cdot \sqrt{h}}{d} \cdot D\right) \cdot \left(\frac{M \cdot \sqrt{h}}{d} \cdot D\right)\right)} \]

      swap-sqr [<=]18.4

      \[ 0 + \color{blue}{\left(0.5 \cdot \left(\frac{M \cdot \sqrt{h}}{d} \cdot D\right)\right) \cdot \left(0.5 \cdot \left(\frac{M \cdot \sqrt{h}}{d} \cdot D\right)\right)} \]

      unpow2 [<=]18.4

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

      *-commutative [=>]18.4

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

      associate-*l/ [=>]18.5

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

      associate-*l/ [=>]18.5

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

      associate-/l* [=>]18.5

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

      associate-*l* [=>]18.2

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

      *-commutative [=>]18.2

      \[ 0 + {\left(\frac{M \cdot \color{blue}{\left(D \cdot \sqrt{h}\right)}}{\frac{d}{0.5}}\right)}^{2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification18.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -4.5 \cdot 10^{+152}:\\ \;\;\;\;0.25 \cdot \left(\left(D \cdot \left(\frac{M}{d} \cdot \frac{h}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt[3]{D} \cdot {\left(\sqrt[3]{D}\right)}^{2}\right)\right)\\ \mathbf{elif}\;h \leq 3 \cdot 10^{-285}:\\ \;\;\;\;0.25 \cdot \left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{M \cdot \left(D \cdot \sqrt{h}\right)}{\frac{d}{0.5}}\right)}^{2}\\ \end{array} \]

Alternatives

Alternative 1
Error17.9
Cost30541
\[\begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(h \cdot w\right) \cdot \left(D \cdot D\right)}\\ t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\ \mathbf{if}\;t_2 \leq -1 \cdot 10^{-125}:\\ \;\;\;\;\frac{d}{D} \cdot \frac{1}{\frac{w}{c0} \cdot \left(\frac{w}{c0} \cdot \left(D \cdot \frac{h}{d}\right)\right)}\\ \mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq \infty\right):\\ \;\;\;\;0.25 \cdot \left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{\frac{d}{D}}{\frac{h \cdot w}{c0} \cdot \frac{D}{d}}\right)\\ \end{array} \]
Alternative 2
Error28.6
Cost1621
\[\begin{array}{l} t_0 := 0.25 \cdot \left(\left(D \cdot \frac{h}{d}\right) \cdot \left(D \cdot \frac{M \cdot M}{d}\right)\right)\\ \mathbf{if}\;D \leq -4.6 \cdot 10^{-22}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;D \leq -3.3 \cdot 10^{-75}:\\ \;\;\;\;\frac{d}{D} \cdot \frac{c0 \cdot \frac{d}{h}}{\frac{w}{c0} \cdot \left(D \cdot w\right)}\\ \mathbf{elif}\;D \leq -4 \cdot 10^{-135}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot \left(h \cdot M\right)\right)}{d \cdot d}\\ \mathbf{elif}\;D \leq -8.2 \cdot 10^{-175} \lor \neg \left(D \leq 1.55 \cdot 10^{-248}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 3
Error27.6
Cost1620
\[\begin{array}{l} t_0 := 0.25 \cdot \left(D \cdot \frac{M \cdot \left(h \cdot M\right)}{d \cdot \frac{d}{D}}\right)\\ \mathbf{if}\;d \leq -5 \cdot 10^{+123}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq -2.05 \cdot 10^{-174}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{-189}:\\ \;\;\;\;\frac{d}{D} \cdot \left(\frac{c0}{\frac{w}{c0}} \cdot \frac{\frac{d}{h}}{D \cdot w}\right)\\ \mathbf{elif}\;d \leq 6.4 \cdot 10^{+98}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{+239}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(D \cdot \frac{h}{d}\right) \cdot \left(D \cdot \frac{M \cdot M}{d}\right)\right)\\ \end{array} \]
Alternative 4
Error30.2
Cost1489
\[\begin{array}{l} \mathbf{if}\;M \leq -4.6 \cdot 10^{+147}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq -2 \cdot 10^{-46} \lor \neg \left(M \leq 4.6 \cdot 10^{-120}\right) \land M \leq 1.3 \cdot 10^{+109}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{\frac{d \cdot d}{h}}{M \cdot M}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 5
Error30.4
Cost1488
\[\begin{array}{l} t_0 := 0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot \left(h \cdot M\right)\right)}{d \cdot d}\\ \mathbf{if}\;d \leq -3.1 \cdot 10^{+55}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-157}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 4.5 \cdot 10^{-189}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{+98}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 6
Error23.6
Cost1481
\[\begin{array}{l} \mathbf{if}\;M \cdot M \leq 2 \cdot 10^{+105} \lor \neg \left(M \cdot M \leq 2 \cdot 10^{+303}\right):\\ \;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{M \cdot \left(h \cdot M\right)}{\frac{d}{D}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(D \cdot \frac{h}{d}\right) \cdot \left(D \cdot \frac{M \cdot M}{d}\right)\right)\\ \end{array} \]
Alternative 7
Error29.1
Cost1480
\[\begin{array}{l} \mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-312}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 2 \cdot 10^{+277}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot \left(h \cdot M\right)\right)}{d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 8
Error21.3
Cost1480
\[\begin{array}{l} \mathbf{if}\;M \cdot M \leq 2 \cdot 10^{+105}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{M \cdot \left(h \cdot M\right)}{\frac{d}{D}}\right)\\ \mathbf{elif}\;M \cdot M \leq 4 \cdot 10^{+226}:\\ \;\;\;\;0.25 \cdot \left(\left(D \cdot \frac{h}{d}\right) \cdot \left(D \cdot \frac{M \cdot M}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{h \cdot M}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\ \end{array} \]
Alternative 9
Error31.9
Cost64
\[0 \]

Error

Reproduce?

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