?

Average Error: 78.6% → 86.9%
Time: 28.3s
Precision: binary64
Cost: 21188.00

?

\[ \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} t_0 := d \cdot \frac{2}{M}\\ t_1 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{+190}:\\ \;\;\;\;w0 \cdot \sqrt{t_1}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{D}{t_0} \cdot \frac{D}{\ell \cdot t_0}\right)}\\ \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
 (let* ((t_0 (* d (/ 2.0 M)))
        (t_1 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
   (if (<= t_1 2e+190)
     (* w0 (sqrt t_1))
     (* w0 (sqrt (- 1.0 (* h (* (/ D t_0) (/ D (* l t_0))))))))))
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 t_0 = d * (2.0 / M);
	double t_1 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_1 <= 2e+190) {
		tmp = w0 * sqrt(t_1);
	} else {
		tmp = w0 * sqrt((1.0 - (h * ((D / t_0) * (D / (l * t_0))))));
	}
	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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = d_1 * (2.0d0 / m)
    t_1 = 1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
    if (t_1 <= 2d+190) then
        tmp = w0 * sqrt(t_1)
    else
        tmp = w0 * sqrt((1.0d0 - (h * ((d / t_0) * (d / (l * t_0))))))
    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 t_0 = d * (2.0 / M);
	double t_1 = 1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_1 <= 2e+190) {
		tmp = w0 * Math.sqrt(t_1);
	} else {
		tmp = w0 * Math.sqrt((1.0 - (h * ((D / t_0) * (D / (l * t_0))))));
	}
	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):
	t_0 = d * (2.0 / M)
	t_1 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))
	tmp = 0
	if t_1 <= 2e+190:
		tmp = w0 * math.sqrt(t_1)
	else:
		tmp = w0 * math.sqrt((1.0 - (h * ((D / t_0) * (D / (l * t_0))))))
	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)
	t_0 = Float64(d * Float64(2.0 / M))
	t_1 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_1 <= 2e+190)
		tmp = Float64(w0 * sqrt(t_1));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(D / t_0) * Float64(D / Float64(l * t_0)))))));
	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)
	t_0 = d * (2.0 / M);
	t_1 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_1 <= 2e+190)
		tmp = w0 * sqrt(t_1);
	else
		tmp = w0 * sqrt((1.0 - (h * ((D / t_0) * (D / (l * t_0))))));
	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_] := Block[{t$95$0 = N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 2e+190], N[(w0 * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(D / t$95$0), $MachinePrecision] * N[(D / N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := d \cdot \frac{2}{M}\\
t_1 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+190}:\\
\;\;\;\;w0 \cdot \sqrt{t_1}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{D}{t_0} \cdot \frac{D}{\ell \cdot t_0}\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 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 2.0000000000000001e190

    1. Initial program 99.7

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

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

    1. Initial program 7.5

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

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

      [Start]7.5

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

      associate-*l/ [<=]9.3

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

      *-commutative [=>]9.3

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left({\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2} \cdot \frac{h}{\ell} + 0\right)}} \]
    4. Simplified34.7

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

      [Start]9.3

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

      +-rgt-identity [=>]9.3

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

      associate-*r/ [=>]34.1

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

      associate-*l/ [<=]34.7

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

      *-commutative [=>]34.7

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

      associate-*r* [=>]34.7

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

      associate-*l/ [=>]33.1

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

      *-commutative [<=]33.1

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

      metadata-eval [<=]33.1

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

      times-frac [<=]33.1

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

      neg-mul-1 [<=]33.1

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

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

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

      *-commutative [<=]33.1

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

      associate-/l* [=>]34.8

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

      *-commutative [=>]34.8

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

      neg-mul-1 [=>]34.8

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

      times-frac [=>]34.8

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

      metadata-eval [=>]34.8

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

      associate-*r/ [=>]34.8

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

      associate-/l* [<=]33.1

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

      times-frac [=>]34.7

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

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

    \[\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^{+190}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{D}{d \cdot \frac{2}{M}} \cdot \frac{D}{\ell \cdot \left(d \cdot \frac{2}{M}\right)}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error84.5%
Cost8393.00
\[\begin{array}{l} t_0 := d \cdot \frac{2}{M}\\ \mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{+227} \lor \neg \left(\frac{h}{\ell} \leq -2 \cdot 10^{-76}\right):\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{D}{t_0} \cdot \frac{D}{\ell \cdot t_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{D}{\frac{\ell}{h}} \cdot \left(\frac{M}{d} \cdot \frac{\frac{D}{\frac{d}{M}}}{4}\right)}\\ \end{array} \]
Alternative 2
Error79.9%
Cost8008.00
\[\begin{array}{l} \mathbf{if}\;d \leq 3.6 \cdot 10^{-20}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq 5 \cdot 10^{+121}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot D}{\frac{d \cdot d}{M \cdot h} \cdot \frac{\ell}{D}} \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 3
Error81.0%
Cost8004.00
\[\begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-265}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{D}{\frac{\ell}{h}} \cdot \left(\frac{M}{d} \cdot \frac{\frac{D}{\frac{d}{M}}}{4}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 4
Error85.6%
Cost8004.00
\[\begin{array}{l} t_0 := d \cdot \frac{2}{M}\\ \mathbf{if}\;M \leq -5 \cdot 10^{+63}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot \left(\frac{D}{d} \cdot -0.5\right)}{\frac{\ell}{h} \cdot \frac{2}{M \cdot \frac{D}{d}}}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{D}{t_0} \cdot \frac{D}{\ell \cdot t_0}\right)}\\ \end{array} \]
Alternative 5
Error77.5%
Cost7876.00
\[\begin{array}{l} \mathbf{if}\;w0 \leq -1.5 \cdot 10^{+95}:\\ \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 6
Error78.0%
Cost7876.00
\[\begin{array}{l} \mathbf{if}\;w0 \leq -1.42 \cdot 10^{+26}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{\left(M \cdot D\right) \cdot \left(h \cdot \left(M \cdot D\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 7
Error79.5%
Cost64.00
\[w0 \]

Error

Reproduce?

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