?

Average Error: 15.5 → 0.4
Time: 1.0min
Precision: binary64
Cost: 45888

?

\[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
\[\sin b \cdot \frac{r}{\cos b \cdot \left(\cos a \cdot 2\right) - \left(\sin b \cdot \sin a + \cos b \cdot \cos a\right)} \]
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
(FPCore (r a b)
 :precision binary64
 (*
  (sin b)
  (/
   r
   (-
    (* (cos b) (* (cos a) 2.0))
    (+ (* (sin b) (sin a)) (* (cos b) (cos a)))))))
double code(double r, double a, double b) {
	return (r * sin(b)) / cos((a + b));
}
double code(double r, double a, double b) {
	return sin(b) * (r / ((cos(b) * (cos(a) * 2.0)) - ((sin(b) * sin(a)) + (cos(b) * cos(a)))));
}
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (r * sin(b)) / cos((a + b))
end function
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = sin(b) * (r / ((cos(b) * (cos(a) * 2.0d0)) - ((sin(b) * sin(a)) + (cos(b) * cos(a)))))
end function
public static double code(double r, double a, double b) {
	return (r * Math.sin(b)) / Math.cos((a + b));
}
public static double code(double r, double a, double b) {
	return Math.sin(b) * (r / ((Math.cos(b) * (Math.cos(a) * 2.0)) - ((Math.sin(b) * Math.sin(a)) + (Math.cos(b) * Math.cos(a)))));
}
def code(r, a, b):
	return (r * math.sin(b)) / math.cos((a + b))
def code(r, a, b):
	return math.sin(b) * (r / ((math.cos(b) * (math.cos(a) * 2.0)) - ((math.sin(b) * math.sin(a)) + (math.cos(b) * math.cos(a)))))
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
end
function code(r, a, b)
	return Float64(sin(b) * Float64(r / Float64(Float64(cos(b) * Float64(cos(a) * 2.0)) - Float64(Float64(sin(b) * sin(a)) + Float64(cos(b) * cos(a))))))
end
function tmp = code(r, a, b)
	tmp = (r * sin(b)) / cos((a + b));
end
function tmp = code(r, a, b)
	tmp = sin(b) * (r / ((cos(b) * (cos(a) * 2.0)) - ((sin(b) * sin(a)) + (cos(b) * cos(a)))));
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[r_, a_, b_] := N[(N[Sin[b], $MachinePrecision] * N[(r / N[(N[(N[Cos[b], $MachinePrecision] * N[(N[Cos[a], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\sin b \cdot \frac{r}{\cos b \cdot \left(\cos a \cdot 2\right) - \left(\sin b \cdot \sin a + \cos b \cdot \cos a\right)}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 15.5

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Simplified15.5

    \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos \left(b + a\right)}} \]
    Proof

    [Start]15.5

    \[ \frac{r \cdot \sin b}{\cos \left(a + b\right)} \]

    rational_best-simplify-3 [=>]15.5

    \[ \frac{r \cdot \sin b}{\cos \color{blue}{\left(b + a\right)}} \]
  3. Applied egg-rr0.3

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
  4. Taylor expanded in r around 0 0.3

    \[\leadsto \color{blue}{\frac{\sin b \cdot r}{\cos a \cdot \cos b - \sin a \cdot \sin b}} \]
  5. Simplified15.5

    \[\leadsto \color{blue}{\sin b \cdot \frac{r}{\cos \left(b + a\right)}} \]
    Proof

    [Start]0.3

    \[ \frac{\sin b \cdot r}{\cos a \cdot \cos b - \sin a \cdot \sin b} \]

    rational_best-simplify-1 [=>]0.3

    \[ \frac{\color{blue}{r \cdot \sin b}}{\cos a \cdot \cos b - \sin a \cdot \sin b} \]

    trig-simplify-14 [=>]15.5

    \[ \frac{r \cdot \sin b}{\color{blue}{\cos \left(a + b\right)}} \]

    rational_best-simplify-3 [<=]15.5

    \[ \frac{r \cdot \sin b}{\cos \color{blue}{\left(b + a\right)}} \]

    rational_best-simplify-8 [<=]15.5

    \[ \frac{r \cdot \sin b}{\color{blue}{\frac{\cos \left(b + a\right)}{1}}} \]

    metadata-eval [<=]15.5

    \[ \frac{r \cdot \sin b}{\frac{\cos \left(b + a\right)}{\color{blue}{-1 \cdot -1}}} \]

    rational_best-simplify-53 [<=]15.5

    \[ \frac{r \cdot \sin b}{\color{blue}{\frac{\frac{\cos \left(b + a\right)}{-1}}{-1}}} \]

    rational_best-simplify-13 [<=]15.5

    \[ \frac{r \cdot \sin b}{\frac{\color{blue}{-\cos \left(b + a\right)}}{-1}} \]

    rational_best-simplify-12 [=>]15.5

    \[ \frac{r \cdot \sin b}{\color{blue}{-\left(-\cos \left(b + a\right)\right)}} \]

    rational_best-simplify-61 [<=]15.5

    \[ \color{blue}{\left(-r\right) \cdot \frac{\sin b}{-\cos \left(b + a\right)}} \]

    rational_best-simplify-55 [=>]15.5

    \[ \color{blue}{\sin b \cdot \frac{-r}{-\cos \left(b + a\right)}} \]

    rational_best-simplify-14 [=>]15.5

    \[ \sin b \cdot \frac{\color{blue}{0 - r}}{-\cos \left(b + a\right)} \]

    rational_best-simplify-58 [=>]15.5

    \[ \sin b \cdot \color{blue}{\frac{r - 0}{\cos \left(b + a\right)}} \]

    rational_best-simplify-9 [=>]15.5

    \[ \sin b \cdot \frac{\color{blue}{r}}{\cos \left(b + a\right)} \]
  6. Applied egg-rr0.4

    \[\leadsto \sin b \cdot \frac{r}{\color{blue}{\cos b \cdot \left(\cos a \cdot 2\right) - \left(\sin b \cdot \sin a + \cos b \cdot \cos a\right)}} \]
  7. Final simplification0.4

    \[\leadsto \sin b \cdot \frac{r}{\cos b \cdot \left(\cos a \cdot 2\right) - \left(\sin b \cdot \sin a + \cos b \cdot \cos a\right)} \]

Alternatives

Alternative 1
Error0.3
Cost32704
\[\sin b \cdot \frac{r}{\cos b \cdot \cos a - \sin b \cdot \sin a} \]
Alternative 2
Error14.9
Cost26496
\[\frac{r \cdot \sin b}{\cos a \cdot \left(\cos b \cdot 2\right) + \left(-\cos \left(b - a\right)\right)} \]
Alternative 3
Error15.6
Cost13384
\[\begin{array}{l} t_0 := \sin b \cdot \frac{r}{\cos b}\\ \mathbf{if}\;b \leq -8.6 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-9}:\\ \;\;\;\;\left(\frac{b}{\cos a} \cdot 1\right) \cdot r\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error15.6
Cost13384
\[\begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sin b \cdot r}{\cos b}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-9}:\\ \;\;\;\;\left(\frac{b}{\cos a} \cdot 1\right) \cdot r\\ \mathbf{else}:\\ \;\;\;\;\sin b \cdot \frac{r}{\cos b}\\ \end{array} \]
Alternative 5
Error15.5
Cost13248
\[r \cdot \frac{\sin b}{\cos \left(b + a\right)} \]
Alternative 6
Error15.5
Cost13248
\[\sin b \cdot \frac{r}{\cos \left(b + a\right)} \]
Alternative 7
Error29.2
Cost13120
\[\sin b \cdot \frac{r}{\cos a} \]
Alternative 8
Error29.2
Cost7112
\[\begin{array}{l} t_0 := \sin b \cdot r\\ \mathbf{if}\;b \leq -19000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{+21}:\\ \;\;\;\;\left(\frac{b}{\cos a} \cdot 1\right) \cdot r\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error29.2
Cost6984
\[\begin{array}{l} t_0 := \sin b \cdot r\\ \mathbf{if}\;b \leq -19000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{+21}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error39.2
Cost6592
\[\sin b \cdot r \]
Alternative 11
Error42.1
Cost192
\[r \cdot b \]

Error

Reproduce?

herbie shell --seed 2023099 
(FPCore (r a b)
  :name "rsin A (should all be same)"
  :precision binary64
  (/ (* r (sin b)) (cos (+ a b))))