?

Average Error: 19.2 → 14.8
Time: 11.2s
Precision: binary64
Cost: 8016

?

\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-232}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{0.5}{\ell}}{\frac{\frac{2}{\frac{A}{V}}}{4}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (* c0 (sqrt (/ A (* V l))))))
   (if (<= (* V l) (- INFINITY))
     (* c0 (sqrt (* (/ A l) (/ 1.0 V))))
     (if (<= (* V l) -2e-232)
       t_0
       (if (<= (* V l) 2e-160)
         (* c0 (sqrt (/ (/ 0.5 l) (/ (/ 2.0 (/ A V)) 4.0))))
         (if (<= (* V l) 2e+164) t_0 (* c0 (sqrt (/ 1.0 (* l (/ V A)))))))))))
double code(double c0, double A, double V, double l) {
	return c0 * sqrt((A / (V * l)));
}
double code(double c0, double A, double V, double l) {
	double t_0 = c0 * sqrt((A / (V * l)));
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = c0 * sqrt(((A / l) * (1.0 / V)));
	} else if ((V * l) <= -2e-232) {
		tmp = t_0;
	} else if ((V * l) <= 2e-160) {
		tmp = c0 * sqrt(((0.5 / l) / ((2.0 / (A / V)) / 4.0)));
	} else if ((V * l) <= 2e+164) {
		tmp = t_0;
	} else {
		tmp = c0 * sqrt((1.0 / (l * (V / A))));
	}
	return tmp;
}
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
public static double code(double c0, double A, double V, double l) {
	double t_0 = c0 * Math.sqrt((A / (V * l)));
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = c0 * Math.sqrt(((A / l) * (1.0 / V)));
	} else if ((V * l) <= -2e-232) {
		tmp = t_0;
	} else if ((V * l) <= 2e-160) {
		tmp = c0 * Math.sqrt(((0.5 / l) / ((2.0 / (A / V)) / 4.0)));
	} else if ((V * l) <= 2e+164) {
		tmp = t_0;
	} else {
		tmp = c0 * Math.sqrt((1.0 / (l * (V / A))));
	}
	return tmp;
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l):
	t_0 = c0 * math.sqrt((A / (V * l)))
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = c0 * math.sqrt(((A / l) * (1.0 / V)))
	elif (V * l) <= -2e-232:
		tmp = t_0
	elif (V * l) <= 2e-160:
		tmp = c0 * math.sqrt(((0.5 / l) / ((2.0 / (A / V)) / 4.0)))
	elif (V * l) <= 2e+164:
		tmp = t_0
	else:
		tmp = c0 * math.sqrt((1.0 / (l * (V / A))))
	return tmp
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
function code(c0, A, V, l)
	t_0 = Float64(c0 * sqrt(Float64(A / Float64(V * l))))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) * Float64(1.0 / V))));
	elseif (Float64(V * l) <= -2e-232)
		tmp = t_0;
	elseif (Float64(V * l) <= 2e-160)
		tmp = Float64(c0 * sqrt(Float64(Float64(0.5 / l) / Float64(Float64(2.0 / Float64(A / V)) / 4.0))));
	elseif (Float64(V * l) <= 2e+164)
		tmp = t_0;
	else
		tmp = Float64(c0 * sqrt(Float64(1.0 / Float64(l * Float64(V / A)))));
	end
	return tmp
end
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
function tmp_2 = code(c0, A, V, l)
	t_0 = c0 * sqrt((A / (V * l)));
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = c0 * sqrt(((A / l) * (1.0 / V)));
	elseif ((V * l) <= -2e-232)
		tmp = t_0;
	elseif ((V * l) <= 2e-160)
		tmp = c0 * sqrt(((0.5 / l) / ((2.0 / (A / V)) / 4.0)));
	elseif ((V * l) <= 2e+164)
		tmp = t_0;
	else
		tmp = c0 * sqrt((1.0 / (l * (V / A))));
	end
	tmp_2 = tmp;
end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] * N[(1.0 / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -2e-232], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e-160], N[(c0 * N[Sqrt[N[(N[(0.5 / l), $MachinePrecision] / N[(N[(2.0 / N[(A / V), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+164], t$95$0, N[(c0 * N[Sqrt[N[(1.0 / N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\

\mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-232}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{0.5}{\ell}}{\frac{\frac{2}{\frac{A}{V}}}{4}}}\\

\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{\ell \cdot \frac{V}{A}}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 41.5

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr23.5

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{A}{\ell} \cdot \frac{1}{V}}} \]

    if -inf.0 < (*.f64 V l) < -2.00000000000000005e-232 or 2e-160 < (*.f64 V l) < 2e164

    1. Initial program 7.8

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

    if -2.00000000000000005e-232 < (*.f64 V l) < 2e-160

    1. Initial program 40.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr28.4

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\left(A \cdot \frac{2}{V}\right) \cdot \frac{1}{\ell + \ell}}} \]
    3. Simplified27.9

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{2}{V} \cdot \left(\frac{0.5}{\ell} \cdot A\right)}} \]
      Proof

      [Start]28.4

      \[ c0 \cdot \sqrt{\left(A \cdot \frac{2}{V}\right) \cdot \frac{1}{\ell + \ell}} \]

      rational.json-simplify-2 [=>]28.4

      \[ c0 \cdot \sqrt{\color{blue}{\frac{1}{\ell + \ell} \cdot \left(A \cdot \frac{2}{V}\right)}} \]

      rational.json-simplify-43 [<=]27.9

      \[ c0 \cdot \sqrt{\color{blue}{\frac{2}{V} \cdot \left(\frac{1}{\ell + \ell} \cdot A\right)}} \]

      metadata-eval [<=]27.9

      \[ c0 \cdot \sqrt{\frac{2}{V} \cdot \left(\frac{\color{blue}{0.5 + 0.5}}{\ell + \ell} \cdot A\right)} \]

      rational.json-simplify-35 [<=]27.9

      \[ c0 \cdot \sqrt{\frac{2}{V} \cdot \left(\color{blue}{\frac{0.5}{\ell}} \cdot A\right)} \]
    4. Applied egg-rr28.5

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{0.5}{\ell}}{\frac{\frac{2}{\frac{A}{V}}}{4}}}} \]

    if 2e164 < (*.f64 V l)

    1. Initial program 27.4

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Simplified19.8

      \[\leadsto \color{blue}{c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}} \]
      Proof

      [Start]27.4

      \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

      rational.json-simplify-46 [=>]20.0

      \[ c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]

      rational.json-simplify-44 [=>]19.8

      \[ c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}} \]
    3. Applied egg-rr27.4

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot V} \cdot A}} \]
    4. Applied egg-rr20.8

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot \frac{V}{A}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification14.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-232}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{0.5}{\ell}}{\frac{\frac{2}{\frac{A}{V}}}{4}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\ell \cdot \frac{V}{A}}}\\ \end{array} \]

Alternatives

Alternative 1
Error14.7
Cost8016
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-237}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
Alternative 2
Error14.7
Cost7888
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-173}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error14.6
Cost7888
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-237}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error14.6
Cost7888
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell} \cdot \frac{1}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-237}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 5
Error19.2
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

herbie shell --seed 2023066 
(FPCore (c0 A V l)
  :name "Henrywood and Agarwal, Equation (3)"
  :precision binary64
  (* c0 (sqrt (/ A (* V l)))))