?

Average Accuracy: 4.6% → 48.8%
Time: 25.4s
Precision: binary64
Cost: 960

?

\[\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{D}{d} \cdot M\\ 0.25 \cdot \left(t_0 \cdot \left(t_0 \cdot h\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 d) M))) (* 0.25 (* t_0 (* t_0 h)))))
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 / d) * M;
	return 0.25 * (t_0 * (t_0 * h));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = (c0 / (2.0d0 * w)) * (((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) + sqrt(((((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) * ((c0 * (d_1 * d_1)) / ((w * h) * (d * d)))) - (m * m))))
end function
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    t_0 = (d / d_1) * m
    code = 0.25d0 * (t_0 * (t_0 * h))
end function
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 / d) * M;
	return 0.25 * (t_0 * (t_0 * h));
}
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 / d) * M
	return 0.25 * (t_0 * (t_0 * h))
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(D / d) * M)
	return Float64(0.25 * Float64(t_0 * Float64(t_0 * h)))
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 = code(c0, w, h, D, d, M)
	t_0 = (D / d) * M;
	tmp = 0.25 * (t_0 * (t_0 * h));
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[(D / d), $MachinePrecision] * M), $MachinePrecision]}, N[(0.25 * N[(t$95$0 * N[(t$95$0 * h), $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 := \frac{D}{d} \cdot M\\
0.25 \cdot \left(t_0 \cdot \left(t_0 \cdot h\right)\right)
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 4.2%

    \[\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 2.8%

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

    \[\leadsto \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)} + \color{blue}{\left(0.5 \cdot \left(\frac{D \cdot D}{d \cdot c0} \cdot \frac{w \cdot \left(M \cdot \left(M \cdot h\right)\right)}{d}\right) - \frac{c0}{w} \cdot \left(\frac{\frac{d}{D}}{D} \cdot \frac{d}{h}\right)\right)}\right) \]
    Step-by-step derivation

    [Start]2.8

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

    mul-1-neg [=>]2.8

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

    unsub-neg [=>]2.8

    \[ \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)} + \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot c0} - \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
  4. Taylor expanded in c0 around 0 31.9%

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

    \[\leadsto \color{blue}{0.25 \cdot \left(\frac{D}{\frac{d \cdot d}{D}} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)} \]
    Step-by-step derivation

    [Start]31.9

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

    associate-/l* [=>]31.9

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

    associate-/r/ [=>]31.6

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

    unpow2 [=>]31.6

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

    associate-/l* [=>]35.6

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

    unpow2 [=>]35.6

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

    *-commutative [=>]35.6

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

    unpow2 [=>]35.6

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

    associate-*r* [<=]36.9

    \[ 0.25 \cdot \left(\frac{D}{\frac{d \cdot d}{D}} \cdot \color{blue}{\left(M \cdot \left(M \cdot h\right)\right)}\right) \]
  6. Applied egg-rr37.1%

    \[\leadsto 0.25 \cdot \color{blue}{\log \left(e^{{\left(\frac{D}{d} \cdot M\right)}^{2} \cdot h}\right)} \]
    Step-by-step derivation

    [Start]36.9

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

    add-log-exp [=>]32.9

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

    associate-*r* [=>]31.7

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

    associate-*r* [=>]33.3

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

    pow1 [=>]33.3

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

    associate-/l* [=>]34.5

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

    associate-/r/ [=>]34.5

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

    pow-prod-down [<=]34.5

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

    pow-prod-up [=>]34.5

    \[ 0.25 \cdot \log \left(e^{\left(\color{blue}{{\left(\frac{D}{d}\right)}^{\left(1 + 1\right)}} \cdot \left(M \cdot M\right)\right) \cdot h}\right) \]

    metadata-eval [=>]34.5

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

    pow2 [=>]34.5

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

    pow-prod-down [=>]37.1

    \[ 0.25 \cdot \log \left(e^{\color{blue}{{\left(\frac{D}{d} \cdot M\right)}^{2}} \cdot h}\right) \]
  7. Applied egg-rr50.5%

    \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\frac{D}{d} \cdot M\right) \cdot \left(\left(\frac{D}{d} \cdot M\right) \cdot h\right)\right)} \]
    Step-by-step derivation

    [Start]37.1

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

    add-log-exp [<=]49.2

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

    unpow2 [=>]49.2

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

    associate-*l* [=>]50.5

    \[ 0.25 \cdot \color{blue}{\left(\left(\frac{D}{d} \cdot M\right) \cdot \left(\left(\frac{D}{d} \cdot M\right) \cdot h\right)\right)} \]
  8. Final simplification50.5%

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

Alternatives

Alternative 1
Accuracy45.7%
Cost960
\[\begin{array}{l} t_0 := \frac{D}{d} \cdot M\\ 0.25 \cdot \left(h \cdot \left(t_0 \cdot t_0\right)\right) \end{array} \]
Alternative 2
Accuracy33.2%
Cost64
\[0 \]

Error

Reproduce?

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