?

Average Error: 0.2 → 0.2
Time: 10.0s
Precision: binary64
Cost: 19776

?

\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
\[\frac{1}{\sin B} - \frac{\cos B \cdot x}{\sin B} \]
(FPCore (B x)
 :precision binary64
 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x)
 :precision binary64
 (- (/ 1.0 (sin B)) (/ (* (cos B) x) (sin B))))
double code(double B, double x) {
	return -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
double code(double B, double x) {
	return (1.0 / sin(B)) - ((cos(B) * x) / sin(B));
}
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -(x * (1.0d0 / tan(b))) + (1.0d0 / sin(b))
end function
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = (1.0d0 / sin(b)) - ((cos(b) * x) / sin(b))
end function
public static double code(double B, double x) {
	return -(x * (1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
}
public static double code(double B, double x) {
	return (1.0 / Math.sin(B)) - ((Math.cos(B) * x) / Math.sin(B));
}
def code(B, x):
	return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
def code(B, x):
	return (1.0 / math.sin(B)) - ((math.cos(B) * x) / math.sin(B))
function code(B, x)
	return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / sin(B)))
end
function code(B, x)
	return Float64(Float64(1.0 / sin(B)) - Float64(Float64(cos(B) * x) / sin(B)))
end
function tmp = code(B, x)
	tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
end
function tmp = code(B, x)
	tmp = (1.0 / sin(B)) - ((cos(B) * x) / sin(B));
end
code[B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[B_, x_] := N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{1}{\sin B} - \frac{\cos B \cdot x}{\sin B}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.2

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Simplified0.2

    \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
    Proof

    [Start]0.2

    \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.2

    \[ \color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-97 [=>]0.2

    \[ \frac{1}{\sin B} + \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-108 [=>]0.2

    \[ \color{blue}{\left(0 + \frac{1}{\sin B}\right) - x \cdot \frac{1}{\tan B}} \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.2

    \[ \color{blue}{\left(\frac{1}{\sin B} + 0\right)} - x \cdot \frac{1}{\tan B} \]

    rational_best_oopsla_all_46_json_45_simplify-85 [=>]0.2

    \[ \color{blue}{\frac{1}{\sin B}} - x \cdot \frac{1}{\tan B} \]
  3. Taylor expanded in x around 0 0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{\cos B \cdot x}{\sin B}} \]
  4. Final simplification0.2

    \[\leadsto \frac{1}{\sin B} - \frac{\cos B \cdot x}{\sin B} \]

Alternatives

Alternative 1
Error0.2
Cost19776
\[\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B} \]
Alternative 2
Error2.1
Cost13512
\[\begin{array}{l} t_0 := -\frac{\cos B \cdot x}{\sin B}\\ \mathbf{if}\;x \leq -2.05 \cdot 10^{+45}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 460:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error2.2
Cost13448
\[\begin{array}{l} t_0 := -\frac{\cos B \cdot x}{\sin B}\\ \mathbf{if}\;x \leq -2.05 \cdot 10^{+45}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 460:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.2
Cost13376
\[\frac{1}{\sin B} - x \cdot \frac{1}{\tan B} \]
Alternative 5
Error10.0
Cost7496
\[\begin{array}{l} t_0 := \left(\frac{1}{B} + B \cdot 0.16666666666666666\right) - x \cdot \frac{1}{\tan B}\\ \mathbf{if}\;x \leq -8 \cdot 10^{+62}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6000000000000:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error18.0
Cost6920
\[\begin{array}{l} t_0 := -\frac{x}{\sin B}\\ \mathbf{if}\;x \leq -0.72:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 480:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error18.6
Cost6856
\[\begin{array}{l} t_0 := \frac{1}{\sin B}\\ \mathbf{if}\;B \leq -5.2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 0.0132:\\ \;\;\;\;\left(\frac{1}{B} + B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error18.5
Cost6848
\[\frac{1}{\sin B} - \frac{x}{B} \]
Alternative 9
Error36.8
Cost520
\[\begin{array}{l} t_0 := -\frac{x}{B}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+17}:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error35.6
Cost448
\[\frac{1}{B} - \frac{x}{B} \]
Alternative 11
Error35.6
Cost320
\[\frac{1 - x}{B} \]
Alternative 12
Error45.1
Cost192
\[\frac{1}{B} \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (B x)
  :name "VandenBroeck and Keller, Equation (24)"
  :precision binary64
  (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))