Average Error: 1.0 → 0.1
Time: 14.2s
Precision: 64
Internal Precision: 128
\[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
\[2 \cdot \left(\sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \sin \left(\frac{\pi}{3}\right) + \cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \frac{1}{2}\right)\]

Error

Bits error versus g

Bits error versus h

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.0

    \[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
  2. Initial simplification1.0

    \[\leadsto \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  3. Using strategy rm
  4. Applied distribute-frac-neg1.0

    \[\leadsto \cos \left(\frac{\cos^{-1} \color{blue}{\left(-\frac{g}{h}\right)}}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  5. Applied acos-neg1.0

    \[\leadsto \cos \left(\frac{\color{blue}{\pi - \cos^{-1} \left(\frac{g}{h}\right)}}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  6. Applied div-sub1.0

    \[\leadsto \cos \left(\color{blue}{\left(\frac{\pi}{3} - \frac{\cos^{-1} \left(\frac{g}{h}\right)}{3}\right)} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  7. Applied associate-+l-1.0

    \[\leadsto \cos \color{blue}{\left(\frac{\pi}{3} - \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right)} \cdot 2\]
  8. Applied cos-diff0.1

    \[\leadsto \color{blue}{\left(\cos \left(\frac{\pi}{3}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) + \sin \left(\frac{\pi}{3}\right) \cdot \sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right)} \cdot 2\]
  9. Simplified0.1

    \[\leadsto \left(\color{blue}{\cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \frac{1}{2}} + \sin \left(\frac{\pi}{3}\right) \cdot \sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right) \cdot 2\]
  10. Final simplification0.1

    \[\leadsto 2 \cdot \left(\sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \sin \left(\frac{\pi}{3}\right) + \cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \frac{1}{2}\right)\]

Reproduce

herbie shell --seed 2018365 
(FPCore (g h)
  :name "2-ancestry mixing, negative discriminant"
  (* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3)))))

Details

Time bar (total: 6.0s)Debug log

start203.0ms

Algorithm
intervals

setup96.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize39.0ms

Local error

Found 4 expressions with local error:

1.0b
(/ PI 3/2)
1.0b
(+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2))
1.0b
(/ (acos (/ (- g) h)) 3)
1.0b
(cos (+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2)))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 50
Calls

4 calls. Slowest were:

14.0ms
(cos (+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2)))
8.0ms
(+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2))
5.0ms
(/ (acos (/ (- g) h)) 3)

series137.0ms

Counts
4 → 10
Calls

4 calls. Slowest were:

95.0ms
(cos (+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2)))
34.0ms
(+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2))
7.0ms
(/ (acos (/ (- g) h)) 3)
0.0ms
(/ PI 3/2)

simplify297.0ms

Counts
23 → 60
Calls

23 calls. Slowest were:

35.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
31.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
27.0ms
(* (cos (/ (/ PI 2) 3)) (cos (- (/ (asin (/ (- g) h)) 3) (/ PI 3/2))))

prune948.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize72.0ms

Local error

Found 4 expressions with local error:

57.1b
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
1.0b
(sin (/ PI 3))
1.0b
(/ PI 3)
1.0b
(/ PI 3/2)

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 38
Calls

4 calls. Slowest were:

16.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
2.0ms
(sin (/ PI 3))
0.0ms
(/ PI 3)

series123.0ms

Counts
4 → 6
Calls

4 calls. Slowest were:

123.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
0.0ms
(sin (/ PI 3))
0.0ms
(/ PI 3/2)
0.0ms
(/ PI 3)

simplify756.0ms

Counts
10 → 44
Calls

10 calls. Slowest were:

269.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)
234.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)
190.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)

prune846.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

57.1b
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
1.0b
(/ PI 3/2)
1.0b
(/ PI 3/2)
1.0b
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 37
Calls

4 calls. Slowest were:

7.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
7.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
0.0ms
(/ PI 3/2)

series83.0ms

Counts
4 → 6
Calls

4 calls. Slowest were:

83.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
0.0ms
(/ PI 3/2)
0.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
0.0ms
(/ PI 3/2)

simplify39.0ms

Counts
6 → 43
Calls

6 calls. Slowest were:

8.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
8.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
8.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))

prune850.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize20.0ms

Local error

Found 4 expressions with local error:

61.3b
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
1.0b
(/ PI 3/2)
1.0b
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
1.0b
(* 2/3 PI)

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 35
Calls

4 calls. Slowest were:

13.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
9.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
0.0ms
(/ PI 3/2)

series81.0ms

Counts
4 → 6
Calls

4 calls. Slowest were:

81.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
0.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
0.0ms
(/ PI 3/2)
0.0ms
(* 2/3 PI)

simplify142.0ms

Counts
9 → 41
Calls

9 calls. Slowest were:

21.0ms
(* (cos (* 1/3 (acos (/ g h)))) (cos (- (* 2/3 PI))))
21.0ms
(* (cos (* 1/3 (acos (/ g h)))) (cos (- (* 2/3 PI))))
16.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))

prune1.0s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes87.0ms

Accuracy

0% (0.0b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 0.1b

bsearch2.0ms