Average Error: 13.3 → 0.2
Time: 35.6s
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 -8049033631.802277:\\ \;\;\;\;\left(\frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 54697.97663712007:\\ \;\;\;\;\left({\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}}\right) \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{1}{\sin B \cdot {F}^{2}}\right) - \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 < -8049033631.802277

    1. Initial program 25.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. Simplified25.4

      \[\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 add-sqr-sqrt25.4

      \[\leadsto {\color{blue}{\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x} \cdot \sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\]
    5. Applied unpow-prod-down25.4

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

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

    if -8049033631.802277 < F < 54697.97663712007

    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. Using strategy rm
    4. Applied add-sqr-sqrt0.3

      \[\leadsto {\color{blue}{\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x} \cdot \sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\]
    5. Applied unpow-prod-down0.3

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

    if 54697.97663712007 < F

    1. Initial program 24.0

      \[\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. Simplified23.9

      \[\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 add-sqr-sqrt23.9

      \[\leadsto {\color{blue}{\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x} \cdot \sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\]
    5. Applied unpow-prod-down24.0

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

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

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

Reproduce

herbie shell --seed 2019016 
(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: 34.4s)Debug log

sample548.0ms

Algorithm
intervals
Results
347×(pre true 80)
155×(body real 80)
62×(body nan 80)
54×(body real 1280)
39×(body real 640)
30×(body real 320)
(body real 160)

simplify97.0ms

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

prune30.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 12.8b

localize81.0ms

Local error

Found 4 expressions with local error:

17.2b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
4.8b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
0.2b
(/ x (tan B))
0.1b
(/ F (sin B))

rewrite37.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
21.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
10.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))
1.0ms
(/ F (sin B))

series425.0ms

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

simplify1.2s

Counts
38 → 75
Calls
38 calls:
Slowest
221.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
178.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
166.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))))
85.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))
72.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))

prune932.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 4 expressions with local error:

17.2b
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
17.2b
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
4.8b
(* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (/ F (sin B)))
0.7b
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))

rewrite90.0ms

Algorithm
rewrite-expression-head
Rules
39×add-exp-log
28×prod-exp
15×add-sqr-sqrt
13×add-cube-cbrt
13×associate-*r*
13×*-un-lft-identity
12×sqrt-prod
12×pow-exp
12×unpow-prod-down
12×pow-to-exp
11×add-cbrt-cube
10×associate-*l*
pow1
add-log-exp
cbrt-unprod
sqrt-div
flip-+
*-commutative
pow-prod-down
pow1/2
flip3-+
rem-sqrt-square
div-inv
pow-prod-up
associate-*r/
pow2
Counts
4 → 94
Calls
4 calls:
Slowest
39.0ms
(* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (/ F (sin B)))
36.0ms
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))
6.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
6.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))

series257.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
155.0ms
(* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (/ F (sin B)))
41.0ms
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))
32.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
28.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))

simplify5.5s

Counts
73 → 106
Calls
73 calls:
Slowest
676.0ms
(sqrt (+ (pow (+ 2 (* F F)) 3) (pow (* 2 x) 3)))
613.0ms
(sqrt (+ (pow (+ 2 (* F F)) 3) (pow (* 2 x) 3)))
413.0ms
(* (* (* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))) (* (* (/ F (sin B)) (/ F (sin B))) (/ F (sin B))))
354.0ms
(* (* (* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2))) (* (* (/ F (sin B)) (/ F (sin B))) (/ F (sin B))))
198.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))

prune1.8s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

17.2b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
4.8b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
0.2b
(/ (* x (cos B)) (sin B))
0.1b
(* x (cos B))

rewrite24.0ms

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

series371.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
142.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
128.0ms
(/ (* x (cos B)) (sin B))
69.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
31.0ms
(* x (cos B))

simplify1.9s

Counts
45 → 78
Calls
45 calls:
Slowest
577.0ms
(/ (* (* (* x (cos B)) (* x (cos B))) (* x (cos B))) (* (* (sin B) (sin B)) (sin B)))
284.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
207.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
134.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))))
74.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))

prune1.3s

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

17.2b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
4.8b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
0.3b
(* x (/ (cos B) (sin B)))
0.1b
(/ (cos B) (sin B))

rewrite44.0ms

Algorithm
rewrite-expression-head
Rules
23×add-cube-cbrt
23×*-un-lft-identity
23×add-sqr-sqrt
18×times-frac
17×associate-*r*
12×add-exp-log
add-cbrt-cube
associate-*l*
unpow-prod-down
pow1
add-log-exp
associate-/l*
div-inv
prod-exp
associate-/r*
*-commutative
associate-*r/
pow-exp
pow-to-exp
cbrt-unprod
div-exp
frac-2neg
pow-pow
clear-num
cbrt-undiv
Counts
4 → 85
Calls
4 calls:
Slowest
20.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
10.0ms
(/ (cos B) (sin B))
8.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
3.0ms
(* x (/ (cos B) (sin B)))

series372.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
163.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
113.0ms
(* x (/ (cos B) (sin B)))
76.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
20.0ms
(/ (cos B) (sin B))

simplify1.6s

Counts
70 → 97
Calls
70 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))))))
195.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
182.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))))
128.0ms
(- (/ 1 B) (+ (* 1/3 B) (* 1/45 (pow B 3))))
82.0ms
(/ (* (* (cos B) (cos B)) (cos B)) (* (* (sin B) (sin B)) (sin B)))

prune1.4s

Pruning

9 alts after pruning (6 fresh and 3 done)

Merged error: 0.0b

regimes321.0ms

Accuracy

98.7% (0.2b remaining)

Error of 0.2b against oracle of 0.1b and baseline of 13.2b

bsearch788.0ms

end0.0ms

sample15.2s

Algorithm
intervals
Results
10561×(pre true 80)
4701×(body real 80)
1719×(body real 1280)
1695×(body nan 80)
1389×(body real 640)
714×(body real 320)
343×(body real 160)