?

Average Accuracy: 77.8% → 86.2%
Time: 21.2s
Precision: binary64
Cost: 21188

?

\[ \begin{array}{c}[M, D] = \mathsf{sort}([M, D])\\ \end{array} \]
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
\[\begin{array}{l} \mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{+250}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{\frac{M}{d} \cdot \left(D \cdot h\right)}{\ell}}\\ \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) 2e+250)
   (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ M (/ (* 2.0 d) D)) 2.0)))))
   (* w0 (sqrt (- 1.0 (* (/ (/ M d) (/ 4.0 D)) (/ (* (/ M d) (* D h)) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 2e+250) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow((M / ((2.0 * d) / D)), 2.0))));
	} else {
		tmp = w0 * sqrt((1.0 - (((M / d) / (4.0 / D)) * (((M / d) * (D * h)) / l))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))) <= 2d+250) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m / ((2.0d0 * d_1) / d)) ** 2.0d0))))
    else
        tmp = w0 * sqrt((1.0d0 - (((m / d_1) / (4.0d0 / d)) * (((m / d_1) * (d * h)) / l))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 2e+250) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((M / ((2.0 * d) / D)), 2.0))));
	} else {
		tmp = w0 * Math.sqrt((1.0 - (((M / d) / (4.0 / D)) * (((M / d) * (D * h)) / l))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
def code(w0, M, D, h, l, d):
	tmp = 0
	if (1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 2e+250:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((M / ((2.0 * d) / D)), 2.0))))
	else:
		tmp = w0 * math.sqrt((1.0 - (((M / d) / (4.0 / D)) * (((M / d) * (D * h)) / l))))
	return tmp
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
end
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 2e+250)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(M / Float64(Float64(2.0 * d) / D)) ^ 2.0)))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M / d) / Float64(4.0 / D)) * Float64(Float64(Float64(M / d) * Float64(D * h)) / l)))));
	end
	return tmp
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))) <= 2e+250)
		tmp = w0 * sqrt((1.0 - ((h / l) * ((M / ((2.0 * d) / D)) ^ 2.0))));
	else
		tmp = w0 * sqrt((1.0 - (((M / d) / (4.0 / D)) * (((M / d) * (D * h)) / l))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+250], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(M / N[(N[(2.0 * d), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M / d), $MachinePrecision] / N[(4.0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * N[(D * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{+250}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{\frac{M}{d} \cdot \left(D \cdot h\right)}{\ell}}\\


\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 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 1.9999999999999998e250

    1. Initial program 99.5%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified98.8%

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

      [Start]99.5

      \[ w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]

      associate-/l* [=>]98.8

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

    if 1.9999999999999998e250 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))

    1. Initial program 3.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified6.4%

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

      [Start]3.0

      \[ w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]

      times-frac [=>]6.4

      \[ w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Applied egg-rr9.6%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)}{\frac{\ell}{h} \cdot 4}}} \]
      Proof

      [Start]6.4

      \[ w0 \cdot \sqrt{1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}} \]

      associate-*r/ [=>]31.3

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

      associate-/l* [=>]9.8

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

      unpow2 [=>]9.8

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

      associate-*l/ [=>]9.8

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

      associate-*l/ [=>]9.8

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{M \cdot \frac{D}{d}}{2}}}{\frac{\ell}{h}}} \]

      frac-times [=>]9.7

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

      associate-/l/ [=>]9.7

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

      clear-num [=>]9.7

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

      un-div-inv [=>]9.7

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

      associate-/r/ [=>]9.5

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

      clear-num [=>]9.5

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

      un-div-inv [=>]9.5

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

      associate-/r/ [=>]9.6

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

      metadata-eval [=>]9.6

      \[ w0 \cdot \sqrt{1 - \frac{\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)}{\frac{\ell}{h} \cdot \color{blue}{4}}} \]
    4. Applied egg-rr17.6%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{d}}{\frac{4}{D}} \cdot \left(\left(\frac{M}{d} \cdot D\right) \cdot \frac{h}{\ell}\right)}} \]
      Proof

      [Start]9.6

      \[ w0 \cdot \sqrt{1 - \frac{\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)}{\frac{\ell}{h} \cdot 4}} \]

      times-frac [=>]20.7

      \[ w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{d} \cdot D}{\frac{\ell}{h}} \cdot \frac{\frac{M}{d} \cdot D}{4}}} \]

      *-commutative [=>]20.7

      \[ w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{d} \cdot D}{4} \cdot \frac{\frac{M}{d} \cdot D}{\frac{\ell}{h}}}} \]

      associate-/l* [=>]20.7

      \[ w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{d}}{\frac{4}{D}}} \cdot \frac{\frac{M}{d} \cdot D}{\frac{\ell}{h}}} \]

      div-inv [=>]17.3

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \frac{1}{\frac{\ell}{h}}\right)}} \]

      clear-num [<=]17.6

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \left(\left(\frac{M}{d} \cdot D\right) \cdot \color{blue}{\frac{h}{\ell}}\right)} \]
    5. Applied egg-rr42.5%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \color{blue}{\frac{\frac{M}{d} \cdot \left(D \cdot h\right)}{\ell}}} \]
      Proof

      [Start]17.6

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \left(\left(\frac{M}{d} \cdot D\right) \cdot \frac{h}{\ell}\right)} \]

      associate-*r/ [=>]45.8

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot D\right) \cdot h}{\ell}}} \]

      associate-*l* [=>]42.5

      \[ w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{\color{blue}{\frac{M}{d} \cdot \left(D \cdot h\right)}}{\ell}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{+250}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{\frac{M}{d} \cdot \left(D \cdot h\right)}{\ell}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy85.2%
Cost8264
\[\begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot D}{\frac{d}{M \cdot \frac{h}{d}} \cdot \frac{\ell}{D}} \cdot -0.25}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-275}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{h}{\ell} \cdot \left(D \cdot \frac{M}{d}\right)\right) \cdot \left(M \cdot \frac{D \cdot -0.25}{d}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 2
Accuracy85.8%
Cost8264
\[\begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot D}{\frac{d}{M \cdot \frac{h}{d}} \cdot \frac{\ell}{D}} \cdot -0.25}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-275}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \left(\frac{h}{\ell} \cdot \left(D \cdot \frac{M}{d}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 3
Accuracy78.4%
Cost8008
\[\begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-10}:\\ \;\;\;\;w0\\ \mathbf{elif}\;\ell \leq -4 \cdot 10^{-124}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot D}{\frac{d}{M \cdot \frac{h}{d}} \cdot \frac{\ell}{D}} \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 4
Accuracy77.7%
Cost8008
\[\begin{array}{l} \mathbf{if}\;d \leq -5.8 \cdot 10^{+135}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq -7.2 \cdot 10^{-86}:\\ \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \frac{M \cdot \left(M \cdot D\right)}{\frac{\frac{\ell}{D}}{\frac{h}{d \cdot d}}}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 5
Accuracy78.2%
Cost64
\[w0 \]

Error

Reproduce?

herbie shell --seed 2023129 
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  :precision binary64
  (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))