| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20680 |
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -2e+23)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 4e+57)
(+ t_0 (/ (pow (+ 2.0 (+ (* F F) (+ x x))) -0.5) (/ (sin B) F)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -2e+23) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 4e+57) {
tmp = t_0 + (pow((2.0 + ((F * F) + (x + x))), -0.5) / (sin(B) / F));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-2d+23)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 4d+57) then
tmp = t_0 + (((2.0d0 + ((f * f) + (x + x))) ** (-0.5d0)) / (sin(b) / f))
else
tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
public static double code(double F, double B, double x) {
double t_0 = -x / Math.tan(B);
double tmp;
if (F <= -2e+23) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 4e+57) {
tmp = t_0 + (Math.pow((2.0 + ((F * F) + (x + x))), -0.5) / (Math.sin(B) / F));
} else {
tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -2e+23: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 4e+57: tmp = t_0 + (math.pow((2.0 + ((F * F) + (x + x))), -0.5) / (math.sin(B) / F)) else: tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2e+23) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 4e+57) tmp = Float64(t_0 + Float64((Float64(2.0 + Float64(Float64(F * F) + Float64(x + x))) ^ -0.5) / Float64(sin(B) / F))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -2e+23) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 4e+57) tmp = t_0 + (((2.0 + ((F * F) + (x + x))) ^ -0.5) / (sin(B) / F)); else tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e+23], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4e+57], N[(t$95$0 + N[(N[Power[N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[(N[Sin[B], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+23}:\\
\;\;\;\;t_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4 \cdot 10^{+57}:\\
\;\;\;\;t_0 + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
Results
if F < -1.9999999999999998e23Initial program 28.5
Simplified28.5
[Start]28.5 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
rational.json-simplify-10 [=>]28.5 | \[ \color{blue}{\frac{x \cdot \frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]28.5 | \[ \frac{\color{blue}{\frac{1}{\tan B} \cdot x}}{-1} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-49 [=>]28.5 | \[ \color{blue}{x \cdot \frac{\frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-44 [=>]28.5 | \[ x \cdot \color{blue}{\frac{\frac{1}{-1}}{\tan B}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]28.5 | \[ x \cdot \frac{\color{blue}{-1}}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]28.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + \color{blue}{x \cdot 2}\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]28.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\left(-\color{blue}{0.5}\right)}
\] |
metadata-eval [=>]28.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\color{blue}{-0.5}}
\] |
Taylor expanded in F around -inf 0.2
Applied egg-rr0.1
Simplified0.1
[Start]0.1 | \[ \left(\frac{x}{-\tan B} + 0\right) + \frac{-1}{\sin B}
\] |
|---|---|
rational.json-simplify-4 [=>]0.1 | \[ \color{blue}{\frac{x}{-\tan B}} + \frac{-1}{\sin B}
\] |
rational.json-simplify-12 [=>]0.1 | \[ \frac{x}{\color{blue}{0 - \tan B}} + \frac{-1}{\sin B}
\] |
rational.json-simplify-50 [=>]0.1 | \[ \color{blue}{\frac{-x}{\tan B - 0}} + \frac{-1}{\sin B}
\] |
rational.json-simplify-5 [=>]0.1 | \[ \frac{-x}{\color{blue}{\tan B}} + \frac{-1}{\sin B}
\] |
if -1.9999999999999998e23 < F < 4.00000000000000019e57Initial program 0.5
Simplified0.5
[Start]0.5 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
rational.json-simplify-10 [=>]0.5 | \[ \color{blue}{\frac{x \cdot \frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]0.5 | \[ \frac{\color{blue}{\frac{1}{\tan B} \cdot x}}{-1} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-49 [=>]0.5 | \[ \color{blue}{x \cdot \frac{\frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-44 [=>]0.5 | \[ x \cdot \color{blue}{\frac{\frac{1}{-1}}{\tan B}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]0.5 | \[ x \cdot \frac{\color{blue}{-1}}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]0.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + \color{blue}{x \cdot 2}\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]0.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\left(-\color{blue}{0.5}\right)}
\] |
metadata-eval [=>]0.5 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\color{blue}{-0.5}}
\] |
Applied egg-rr0.4
Simplified0.5
[Start]0.4 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\frac{\sin B}{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}}
\] |
|---|---|
rational.json-simplify-61 [=>]0.5 | \[ x \cdot \frac{-1}{\tan B} + \color{blue}{\frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}}
\] |
Applied egg-rr0.4
Simplified0.4
[Start]0.4 | \[ \left(\frac{x}{-\tan B} + 0\right) + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}
\] |
|---|---|
rational.json-simplify-4 [=>]0.4 | \[ \color{blue}{\frac{x}{-\tan B}} + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}
\] |
rational.json-simplify-12 [=>]0.4 | \[ \frac{x}{\color{blue}{0 - \tan B}} + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}
\] |
rational.json-simplify-50 [=>]0.4 | \[ \color{blue}{\frac{-x}{\tan B - 0}} + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}
\] |
rational.json-simplify-5 [=>]0.4 | \[ \frac{-x}{\color{blue}{\tan B}} + \frac{{\left(2 + \left(F \cdot F + \left(x + x\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}}
\] |
if 4.00000000000000019e57 < F Initial program 29.9
Simplified29.9
[Start]29.9 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
rational.json-simplify-10 [=>]29.9 | \[ \color{blue}{\frac{x \cdot \frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]29.9 | \[ \frac{\color{blue}{\frac{1}{\tan B} \cdot x}}{-1} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-49 [=>]29.9 | \[ \color{blue}{x \cdot \frac{\frac{1}{\tan B}}{-1}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-44 [=>]29.9 | \[ x \cdot \color{blue}{\frac{\frac{1}{-1}}{\tan B}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]29.9 | \[ x \cdot \frac{\color{blue}{-1}}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
rational.json-simplify-2 [=>]29.9 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + \color{blue}{x \cdot 2}\right)}^{\left(-\frac{1}{2}\right)}
\] |
metadata-eval [=>]29.9 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\left(-\color{blue}{0.5}\right)}
\] |
metadata-eval [=>]29.9 | \[ x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{\color{blue}{-0.5}}
\] |
Taylor expanded in F around inf 0.2
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20680 |
| Alternative 2 | |
|---|---|
| Error | 0.7 |
| Cost | 20488 |
| Alternative 3 | |
|---|---|
| Error | 0.7 |
| Cost | 20488 |
| Alternative 4 | |
|---|---|
| Error | 0.7 |
| Cost | 20424 |
| Alternative 5 | |
|---|---|
| Error | 5.8 |
| Cost | 14280 |
| Alternative 6 | |
|---|---|
| Error | 11.3 |
| Cost | 14168 |
| Alternative 7 | |
|---|---|
| Error | 8.3 |
| Cost | 14088 |
| Alternative 8 | |
|---|---|
| Error | 6.0 |
| Cost | 14088 |
| Alternative 9 | |
|---|---|
| Error | 21.6 |
| Cost | 13976 |
| Alternative 10 | |
|---|---|
| Error | 21.5 |
| Cost | 13976 |
| Alternative 11 | |
|---|---|
| Error | 8.3 |
| Cost | 13968 |
| Alternative 12 | |
|---|---|
| Error | 8.3 |
| Cost | 13968 |
| Alternative 13 | |
|---|---|
| Error | 8.2 |
| Cost | 13968 |
| Alternative 14 | |
|---|---|
| Error | 16.6 |
| Cost | 13844 |
| Alternative 15 | |
|---|---|
| Error | 26.1 |
| Cost | 8220 |
| Alternative 16 | |
|---|---|
| Error | 27.7 |
| Cost | 7960 |
| Alternative 17 | |
|---|---|
| Error | 22.8 |
| Cost | 7880 |
| Alternative 18 | |
|---|---|
| Error | 22.7 |
| Cost | 7880 |
| Alternative 19 | |
|---|---|
| Error | 28.3 |
| Cost | 7572 |
| Alternative 20 | |
|---|---|
| Error | 27.7 |
| Cost | 7308 |
| Alternative 21 | |
|---|---|
| Error | 32.2 |
| Cost | 7112 |
| Alternative 22 | |
|---|---|
| Error | 29.9 |
| Cost | 7112 |
| Alternative 23 | |
|---|---|
| Error | 37.5 |
| Cost | 6724 |
| Alternative 24 | |
|---|---|
| Error | 40.3 |
| Cost | 968 |
| Alternative 25 | |
|---|---|
| Error | 40.3 |
| Cost | 584 |
| Alternative 26 | |
|---|---|
| Error | 45.2 |
| Cost | 452 |
| Alternative 27 | |
|---|---|
| Error | 47.6 |
| Cost | 388 |
| Alternative 28 | |
|---|---|
| Error | 56.8 |
| Cost | 192 |
herbie shell --seed 2023075
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))