?

Average Accuracy: 99.7% → 99.8%
Time: 13.8s
Precision: binary64
Cost: 19648

?

\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
\[\frac{\frac{\tan B}{\sin B} - x}{\tan B} \]
(FPCore (B x)
 :precision binary64
 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))
(FPCore (B x) :precision binary64 (/ (- (/ (tan B) (sin B)) x) (tan B)))
double code(double B, double x) {
	return -(x * (1.0 / tan(B))) + (1.0 / sin(B));
}
double code(double B, double x) {
	return ((tan(B) / sin(B)) - x) / tan(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 = ((tan(b) / sin(b)) - x) / tan(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 ((Math.tan(B) / Math.sin(B)) - x) / Math.tan(B);
}
def code(B, x):
	return -(x * (1.0 / math.tan(B))) + (1.0 / math.sin(B))
def code(B, x):
	return ((math.tan(B) / math.sin(B)) - x) / math.tan(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(Float64(tan(B) / sin(B)) - x) / tan(B))
end
function tmp = code(B, x)
	tmp = -(x * (1.0 / tan(B))) + (1.0 / sin(B));
end
function tmp = code(B, x)
	tmp = ((tan(B) / sin(B)) - x) / tan(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[(N[(N[Tan[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\frac{\frac{\tan B}{\sin B} - x}{\tan B}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    Step-by-step derivation

    [Start]99.6

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

    +-commutative [=>]99.6

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

    unsub-neg [=>]99.6

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

    associate-*r/ [=>]99.7

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

    *-rgt-identity [=>]99.7

    \[ \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{\tan B - x \cdot \sin B}{\sin B}}{\tan B}} \]
    Step-by-step derivation

    [Start]99.7

    \[ \frac{1}{\sin B} - \frac{x}{\tan B} \]

    frac-sub [=>]87.4

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

    associate-/r* [=>]99.7

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

    *-un-lft-identity [<=]99.7

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

    *-commutative [=>]99.7

    \[ \frac{\frac{\tan B - \color{blue}{x \cdot \sin B}}{\sin B}}{\tan B} \]
  4. Applied egg-rr99.7%

    \[\leadsto \frac{\color{blue}{\frac{\tan B}{\sin B} + \left(-\frac{\sin B}{\frac{\sin B}{x}}\right)}}{\tan B} \]
    Step-by-step derivation

    [Start]99.7

    \[ \frac{\frac{\tan B - x \cdot \sin B}{\sin B}}{\tan B} \]

    div-sub [=>]99.7

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

    sub-neg [=>]99.7

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

    *-commutative [=>]99.7

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

    associate-/l* [=>]99.7

    \[ \frac{\frac{\tan B}{\sin B} + \left(-\color{blue}{\frac{\sin B}{\frac{\sin B}{x}}}\right)}{\tan B} \]
  5. Simplified99.7%

    \[\leadsto \frac{\color{blue}{\frac{\tan B}{\sin B} - x}}{\tan B} \]
    Step-by-step derivation

    [Start]99.7

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

    sub-neg [<=]99.7

    \[ \frac{\color{blue}{\frac{\tan B}{\sin B} - \frac{\sin B}{\frac{\sin B}{x}}}}{\tan B} \]

    associate-/r/ [=>]99.7

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

    *-inverses [=>]99.7

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

    *-lft-identity [=>]99.7

    \[ \frac{\frac{\tan B}{\sin B} - \color{blue}{x}}{\tan B} \]
  6. Final simplification99.7%

    \[\leadsto \frac{\frac{\tan B}{\sin B} - x}{\tan B} \]

Alternatives

Alternative 1
Accuracy99.8%
Cost13248
\[\frac{1}{\sin B} - \frac{x}{\tan B} \]
Alternative 2
Accuracy98.6%
Cost7241
\[\begin{array}{l} \mathbf{if}\;x \leq -2.85 \lor \neg \left(x \leq 2.8\right):\\ \;\;\;\;\left(\frac{1}{B} + -1\right) - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
Alternative 3
Accuracy98.5%
Cost7112
\[\begin{array}{l} \mathbf{if}\;x \leq -1100000:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;x \leq 2.8:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\tan B}\\ \end{array} \]
Alternative 4
Accuracy98.1%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{-7} \lor \neg \left(x \leq 2.8\right):\\ \;\;\;\;\frac{1 - x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
Alternative 5
Accuracy97.6%
Cost6921
\[\begin{array}{l} \mathbf{if}\;x \leq -3.6 \lor \neg \left(x \leq 2.8\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
Alternative 6
Accuracy75.1%
Cost6856
\[\begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{-7}:\\ \;\;\;\;\left(\frac{1}{B} + B \cdot 0.16666666666666666\right) - \frac{x}{B}\\ \mathbf{elif}\;x \leq 2.8:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
Alternative 7
Accuracy49.6%
Cost521
\[\begin{array}{l} \mathbf{if}\;x \leq -30000000000000 \lor \neg \left(x \leq 2.3 \cdot 10^{-22}\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]
Alternative 8
Accuracy51.5%
Cost320
\[\frac{1 - x}{B} \]
Alternative 9
Accuracy26.4%
Cost192
\[\frac{1}{B} \]

Error

Reproduce?

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