Average Error: 0.6 → 0.5
Time: 36.4s
Precision: 64
Internal Precision: 128
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[\left(a1 \cdot a1\right) \cdot \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} + \left(a2 \cdot \cos th\right) \cdot \frac{a2}{\sqrt{2}}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.6

    \[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  2. Simplified0.6

    \[\leadsto \color{blue}{\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.6

    \[\leadsto \frac{\cos th}{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}}} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)\]
  5. Applied associate-/r*0.6

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}}} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.6

    \[\leadsto \color{blue}{\frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a2 \cdot a2\right)}\]
  8. Simplified0.5

    \[\leadsto \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}}}\]
  9. Using strategy rm
  10. Applied div-inv0.5

    \[\leadsto \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \frac{a2 \cdot \cos th}{\color{blue}{\sqrt{2} \cdot \frac{1}{a2}}}\]
  11. Applied times-frac0.5

    \[\leadsto \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\frac{a2}{\sqrt{2}} \cdot \frac{\cos th}{\frac{1}{a2}}}\]
  12. Simplified0.5

    \[\leadsto \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \frac{a2}{\sqrt{2}} \cdot \color{blue}{\left(\cos th \cdot a2\right)}\]
  13. Final simplification0.5

    \[\leadsto \left(a1 \cdot a1\right) \cdot \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} + \left(a2 \cdot \cos th\right) \cdot \frac{a2}{\sqrt{2}}\]

Reproduce

herbie shell --seed 2019007 
(FPCore (a1 a2 th)
  :name "Migdal et al, Equation (64)"
  (+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))

Details

Time bar (total: 35.3s)Debug log

sample274.0ms

Algorithm
intervals

simplify67.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

67.0ms
(+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2)))

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.7b

localize39.0ms

Local error

Found 2 expressions with local error:

0.7b
(/ (cos th) (sqrt 2))
0.5b
(* (/ (cos th) (sqrt 2)) (+ (* a1 a1) (* a2 a2)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
2 → 63
Calls

2 calls. Slowest were:

8.0ms
(* (/ (cos th) (sqrt 2)) (+ (* a1 a1) (* a2 a2)))
3.0ms
(/ (cos th) (sqrt 2))

series205.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

173.0ms
(* (/ (cos th) (sqrt 2)) (+ (* a1 a1) (* a2 a2)))
33.0ms
(/ (cos th) (sqrt 2))

simplify2.7s

Counts
60 → 69
Calls

60 calls. Slowest were:

372.0ms
(* (cos th) (- (* (* a1 a1) (* a1 a1)) (* (* a2 a2) (* a2 a2))))
356.0ms
(* (sqrt 2) (- (* a1 a1) (* a2 a2)))
275.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))

prune949.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.2b

localize11.0ms

Local error

Found 2 expressions with local error:

0.4b
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
0.4b
(* (cos th) (+ (* a1 a1) (* a2 a2)))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
2 → 44
Calls

2 calls. Slowest were:

16.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
13.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))

series283.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

166.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
117.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))

simplify1.6s

Counts
34 → 50
Calls

34 calls. Slowest were:

360.0ms
(* (cos th) (- (* (* a1 a1) (* a1 a1)) (* (* a2 a2) (* a2 a2))))
205.0ms
(/ (* (* (* (cos th) (cos th)) (cos th)) (* (* (+ (* a1 a1) (* a2 a2)) (+ (* a1 a1) (* a2 a2))) (+ (* a1 a1) (* a2 a2)))) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
164.0ms
(+ (* (* a1 a1) (* a1 a1)) (- (* (* a2 a2) (* a2 a2)) (* (* a1 a1) (* a2 a2))))

prune589.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.2b

localize27.0ms

Local error

Found 3 expressions with local error:

0.6b
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
0.5b
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (+ (* a1 a1) (* a2 a2)))
0.1b
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
3 → 166
Calls

3 calls. Slowest were:

24.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (+ (* a1 a1) (* a2 a2)))
11.0ms
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
11.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))

series661.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

435.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
170.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (+ (* a1 a1) (* a2 a2)))
55.0ms
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))

simplify8.1s

Counts
191 → 175
Calls

191 calls. Slowest were:

481.0ms
(+ (- (- (log (cos th)) (log (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (log (cbrt (sqrt 2)))) (log (+ (* a1 a1) (* a2 a2))))
458.0ms
(/ (/ (* (* (cos th) (cos th)) (cos th)) (* (* (* (cbrt (sqrt 2)) (cbrt (sqrt 2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (sqrt 2))
306.0ms
(* (cbrt (sqrt 2)) (- (* a1 a1) (* a2 a2)))

prune2.7s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 4 expressions with local error:

0.6b
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
0.4b
(/ (sqrt 2) a2)
0.3b
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (* a1 a1))
0.2b
(/ (* a2 (cos th)) (/ (sqrt 2) a2))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 121
Calls

4 calls. Slowest were:

15.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (* a1 a1))
8.0ms
(/ (* a2 (cos th)) (/ (sqrt 2) a2))
6.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))

series775.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

600.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
79.0ms
(/ (* a2 (cos th)) (/ (sqrt 2) a2))
72.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (* a1 a1))
24.0ms
(/ (sqrt 2) a2)

simplify4.9s

Counts
96 → 133
Calls

96 calls. Slowest were:

537.0ms
(* (/ (/ (* (* (cos th) (cos th)) (cos th)) (* (sqrt 2) (sqrt 2))) (sqrt 2)) (* (* (* a1 a1) (* a1 a1)) (* a1 a1)))
533.0ms
(+ (- (- (log (cos th)) (+ (log (cbrt (sqrt 2))) (log (cbrt (sqrt 2))))) (log (cbrt (sqrt 2)))) (log (* a1 a1)))
385.0ms
(+ (- (log (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (log (cbrt (sqrt 2)))) (log (* a1 a1)))

prune2.0s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

regimes495.0ms

Accuracy

0% (0.4b remaining)

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

bsearch5.0ms

end0.0ms

sample8.9s

Algorithm
intervals