Average Error: 0.5 → 0.5
Time: 45.7s
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)\]
\[\frac{\frac{\left(\sqrt{(a1 \cdot a1 + \left(a2 \cdot a2\right))_*} \cdot \cos th\right) \cdot \sqrt{a1^2 + a2^2}^*}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

Derivation

  1. Initial program 0.5

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

    \[\leadsto \color{blue}{\frac{\cos th}{\sqrt{2}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*}\]
  3. Using strategy rm
  4. Applied associate-*l/0.5

    \[\leadsto \color{blue}{\frac{\cos th \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*}{\sqrt{2}}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.5

    \[\leadsto \frac{\cos th \cdot \color{blue}{\left(\sqrt{(a1 \cdot a1 + \left(a2 \cdot a2\right))_*} \cdot \sqrt{(a1 \cdot a1 + \left(a2 \cdot a2\right))_*}\right)}}{\sqrt{2}}\]
  7. Applied associate-*r*0.5

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

    \[\leadsto \frac{\left(\cos th \cdot \sqrt{(a1 \cdot a1 + \left(a2 \cdot a2\right))_*}\right) \cdot \color{blue}{\sqrt{a1^2 + a2^2}^*}}{\sqrt{2}}\]
  9. Using strategy rm
  10. Applied add-cube-cbrt0.5

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

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

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

Reproduce

herbie shell --seed 2019004 +o rules:numerics
(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: 44.3s)Debug log

sample316.0ms

Algorithm
intervals

simplify99.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune27.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.5b

localize41.0ms

Local error

Found 2 expressions with local error:

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

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
2 → 63
Calls

2 calls. Slowest were:

13.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
7.0ms
(/ (cos th) (sqrt 2))

series228.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

180.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
49.0ms
(/ (cos th) (sqrt 2))

simplify1.1s

Counts
54 → 69
Calls

54 calls. Slowest were:

291.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
124.0ms
(- (+ (/ 1 (sqrt 2)) (* 1/24 (/ (pow th 4) (sqrt 2)))) (* 1/2 (/ (pow th 2) (sqrt 2))))
117.0ms
(* (/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2))) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))

prune949.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 2 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
2 → 44
Calls

2 calls. Slowest were:

9.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))
8.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (sqrt 2))

series271.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

147.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (sqrt 2))
124.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))

simplify1.1s

Counts
30 → 50
Calls

30 calls. Slowest were:

498.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
103.0ms
(/ (* (* (* (cos th) (cos th)) (cos th)) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2)))) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
98.0ms
(/ (* (* (* (cos th) (fma a1 a1 (* a2 a2))) (* (cos th) (fma a1 a1 (* a2 a2)))) (* (cos th) (fma a1 a1 (* a2 a2)))) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))

prune639.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize25.0ms

Local error

Found 4 expressions with local error:

5.0b
(sqrt (fma a1 a1 (* a2 a2)))
0.4b
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (sqrt 2))
0.1b
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))
0.1b
(* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 82
Calls

4 calls. Slowest were:

13.0ms
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (sqrt 2))
11.0ms
(* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))
5.0ms
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))

series517.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

221.0ms
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (sqrt 2))
154.0ms
(* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))
107.0ms
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))
35.0ms
(sqrt (fma a1 a1 (* a2 a2)))

simplify3.1s

Counts
53 → 94
Calls

53 calls. Slowest were:

1.1s
(* (* (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt (fma a1 a1 (* a2 a2))) (sqrt (fma a1 a1 (* a2 a2)))) (sqrt (fma a1 a1 (* a2 a2))))) (* (* (hypot a1 a2) (hypot a1 a2)) (hypot a1 a2)))
278.0ms
(* (* (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (* (cos th) (sqrt (fma a1 a1 (* a2 a2))))) (* (cos th) (sqrt (fma a1 a1 (* a2 a2))))) (* (* (hypot a1 a2) (hypot a1 a2)) (hypot a1 a2)))
221.0ms
(- (log (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))) (log (sqrt 2)))

prune1.4s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

localize24.0ms

Local error

Found 4 expressions with local error:

5.0b
(sqrt (fma a1 a1 (* a2 a2)))
0.3b
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
0.2b
(/ (/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
0.1b
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))

rewrite62.0ms

Algorithm
rewrite-expression-head
Counts
4 → 132
Calls

4 calls. Slowest were:

29.0ms
(/ (/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
16.0ms
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
9.0ms
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))

series1.3s

Counts
4 → 12
Calls

4 calls. Slowest were:

868.0ms
(/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
262.0ms
(/ (/ (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
101.0ms
(* (cos th) (sqrt (fma a1 a1 (* a2 a2))))
28.0ms
(sqrt (fma a1 a1 (* a2 a2)))

simplify20.6s

Counts
128 → 144
Calls

128 calls. Slowest were:

714.0ms
(/ (* (* (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt (fma a1 a1 (* a2 a2))) (sqrt (fma a1 a1 (* a2 a2)))) (sqrt (fma a1 a1 (* a2 a2))))) (* (* (hypot a1 a2) (hypot a1 a2)) (hypot a1 a2))) (* (sqrt 2) (sqrt 2)))
663.0ms
(- (- (log (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))) (log (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (log (cbrt (sqrt 2))))
565.0ms
(/ (/ (* (* (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2)) (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))) (* (* (cos th) (sqrt (fma a1 a1 (* a2 a2)))) (hypot a1 a2))) (* (sqrt 2) (sqrt 2))) (sqrt 2))

prune2.5s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

regimes573.0ms

Accuracy

0% (0.4b remaining)

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

bsearch3.0ms

end0.0ms

sample9.4s

Algorithm
intervals