Average Error: 13.6 → 0.2
Time: 29.0s
Precision: 64
Internal Precision: 128
\[\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} \mathbf{if}\;F \le -15994.809278368788:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 85996869.67002515:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\frac{-1}{2}} - \frac{x \cdot \cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{{F}^{2}}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if F < -15994.809278368788

    1. Initial program 24.3

      \[\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)}\]
    2. Simplified24.3

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied associate-*r/19.2

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B}} - \frac{x}{\tan B}\]
    5. Taylor expanded around -inf 0.1

      \[\leadsto \frac{\color{blue}{\frac{1}{{F}^{2}} - 1}}{\sin B} - \frac{x}{\tan B}\]

    if -15994.809278368788 < F < 85996869.67002515

    1. Initial program 0.4

      \[\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)}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
    3. Taylor expanded around inf 0.3

      \[\leadsto {\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \color{blue}{\frac{x \cdot \cos B}{\sin B}}\]

    if 85996869.67002515 < F

    1. Initial program 25.7

      \[\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)}\]
    2. Simplified25.7

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied associate-*r/20.6

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B}} - \frac{x}{\tan B}\]
    5. Taylor expanded around inf 0.1

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{{F}^{2}}}}{\sin B} - \frac{x}{\tan B}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -15994.809278368788:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 85996869.67002515:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\frac{-1}{2}} - \frac{x \cdot \cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{{F}^{2}}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

herbie shell --seed 2019022 
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))

Details

Time bar (total: 27.6s)Debug log

sample438.0ms

Algorithm
intervals
Results
124.0ms149×body80valid
102.0ms54×body1280valid
56.0ms44×body640valid
21.0ms24×body320valid
15.0ms48×body80nan
9.0ms14×body160valid

simplify132.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
131.0ms
(+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))

prune35.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 15.1b

localize72.0ms

Local error

Found 4 expressions with local error:

17.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
7.1b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
0.2b
(/ x (tan B))
0.2b
(/ F (sin B))

rewrite49.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×add-exp-log
10×*-un-lft-identity
10×add-sqr-sqrt
associate-*l*
add-cbrt-cube
unpow-prod-down
associate-/r*
pow1
add-log-exp
associate-*r*
div-inv
prod-exp
pow-exp
frac-2neg
clear-num
pow-to-exp
cbrt-unprod
*-commutative
associate-/r/
associate-*r/
tan-quot
pow-pow
Counts
4 → 63
Calls
4 calls:
Slowest
23.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
21.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
1.0ms
(/ x (tan B))
1.0ms
(/ F (sin B))

series468.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
150.0ms
(/ x (tan B))
149.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
99.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
70.0ms
(/ F (sin B))

simplify1.2s

Counts
38 → 75
Calls
38 calls:
Slowest
227.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
175.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
171.0ms
(* (* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)) (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)) (* (* (/ F (sin B)) (/ F (sin B))) (/ F (sin B))))
58.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))
57.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))

prune953.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 4 expressions with local error:

17.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.2b
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
0.2b
(/ x (tan B))

rewrite29.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
add-exp-log
associate-*l*
add-cbrt-cube
unpow-prod-down
associate-/r*
pow1
add-log-exp
times-frac
div-inv
frac-2neg
clear-num
associate-/l*
*-commutative
associate-/r/
tan-quot
pow-exp
div-exp
pow-pow
cbrt-undiv
pow-to-exp
Counts
4 → 60
Calls
4 calls:
Slowest
12.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
11.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
4.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))

series359.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
146.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
111.0ms
(/ x (tan B))
56.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
46.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.8s

Counts
38 → 72
Calls
38 calls:
Slowest
469.0ms
(/ (* (* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (* (sin B) (sin B)) (sin B)))
260.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
239.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
201.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
44.0ms
(* (cbrt (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)) (cbrt (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)))

prune953.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

17.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.2b
(/ x (tan B))
0.2b
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))

rewrite38.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×associate-/r*
10×add-sqr-sqrt
add-exp-log
associate-*l*
unpow-prod-down
pow1
add-log-exp
add-cbrt-cube
div-inv
times-frac
associate-/r/
frac-2neg
clear-num
rec-exp
inv-pow
pow-flip
*-commutative
tan-quot
pow-exp
div-exp
pow-pow
pow-to-exp
Counts
4 → 63
Calls
4 calls:
Slowest
18.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
10.0ms
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))
8.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))

series365.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
132.0ms
(/ x (tan B))
120.0ms
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))
76.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
36.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.3s

Counts
35 → 75
Calls
35 calls:
Slowest
280.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
248.0ms
(- (+ (* 1/6 (* F (* B (sqrt 1/2)))) (/ (* F (sqrt 1/2)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2)))))
203.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
43.0ms
(/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F))
42.0ms
(pow (* (cbrt (+ (+ 2 (* F F)) (* 2 x))) (cbrt (+ (+ 2 (* F F)) (* 2 x)))) -1/2)

prune1.0s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

17.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.2b
(* (/ x (sin B)) (cos B))
0.2b
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))

rewrite33.0ms

Algorithm
rewrite-expression-head
Rules
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
10×add-exp-log
10×associate-*l*
pow1
associate-/r*
add-cbrt-cube
unpow-prod-down
add-log-exp
div-inv
associate-*r*
times-frac
*-commutative
rec-exp
inv-pow
pow-flip
cbrt-unprod
associate-/r/
prod-exp
pow-exp
associate-*l/
pow-prod-down
div-exp
frac-2neg
pow-pow
clear-num
pow-to-exp
Counts
4 → 68
Calls
4 calls:
Slowest
11.0ms
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))
8.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
7.0ms
(* (/ x (sin B)) (cos B))
6.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

series404.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
147.0ms
(/ 1 (/ (sin B) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)))
129.0ms
(* (/ x (sin B)) (cos B))
64.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
63.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

simplify1.5s

Counts
40 → 80
Calls
40 calls:
Slowest
248.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
211.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
205.0ms
(- (+ (* 1/6 (* F (* B (sqrt 1/2)))) (/ (* F (sqrt 1/2)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2)))))
168.0ms
(* (* (* (/ x (sin B)) (/ x (sin B))) (/ x (sin B))) (* (* (cos B) (cos B)) (cos B)))
47.0ms
(pow (* (cbrt (+ (+ 2 (* F F)) (* 2 x))) (cbrt (+ (+ 2 (* F F)) (* 2 x)))) -1/2)

prune1.3s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

regimes332.0ms

Accuracy

98.3% (0.2b remaining)

Error of 0.2b against oracle of 0.0b and baseline of 10.9b

bsearch503.0ms

end0.0ms

sample14.3s

Algorithm
intervals
Results
5.7s1695×body1280valid
3.8s1373×body640valid
2.4s4804×body80valid
1.0s677×body320valid
753.0ms1629×body80nan
403.0ms349×body160valid