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

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. Initial simplification0.5

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

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

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

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

    \[\leadsto \frac{\frac{\cos th}{\sqrt{\sqrt{2}}}}{\color{blue}{\sqrt{1} \cdot \sqrt{\sqrt{2}}}} \cdot (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  9. Applied div-inv0.6

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

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

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

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

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

Reproduce

herbie shell --seed 2018360 +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.7s)Debug log

start315.0ms

Algorithm
intervals

setup134.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize24.0ms

Local error

Found 2 expressions with local error:

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
2 → 63
Calls

2 calls. Slowest were:

6.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
3.0ms
(/ (cos th) (sqrt 2))

series228.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

182.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
46.0ms
(/ (cos th) (sqrt 2))

simplify1.0s

Counts
54 → 69
Calls

54 calls. Slowest were:

124.0ms
(- (+ (/ 1 (sqrt 2)) (* 1/24 (/ (pow th 4) (sqrt 2)))) (* 1/2 (/ (pow th 2) (sqrt 2))))
103.0ms
(+ (/ (* (pow a1 2) (cos th)) (sqrt 2)) (/ (* (cos th) (pow a2 2)) (sqrt 2)))
97.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))))

prune963.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 3 expressions with local error:

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

rewrite47.0ms

Algorithm
rewrite-expression-head
Counts
3 → 377
Calls

3 calls. Slowest were:

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

series322.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

181.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
84.0ms
(/ (cos th) (sqrt (sqrt 2)))
57.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))

simplify10.2s

Counts
499 → 386
Calls

499 calls. Slowest were:

582.0ms
(* (/ (* (* (/ (cos th) (sqrt (sqrt 2))) (/ (cos th) (sqrt (sqrt 2)))) (/ (cos th) (sqrt (sqrt 2)))) (* (* (sqrt (sqrt 2)) (sqrt (sqrt 2))) (sqrt (sqrt 2)))) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
430.0ms
(/ (* (* (/ (cos th) (sqrt (sqrt 2))) (/ (cos th) (sqrt (sqrt 2)))) (/ (cos th) (sqrt (sqrt 2)))) (* (* (sqrt (sqrt 2)) (sqrt (sqrt 2))) (sqrt (sqrt 2))))
338.0ms
(- (+ (sqrt (/ 1 (sqrt 2))) (* 1/24 (* (sqrt (/ 1 (sqrt 2))) (pow th 4)))) (* 1/2 (* (sqrt (/ 1 (sqrt 2))) (pow th 2))))

prune5.9s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize33.0ms

Local error

Found 4 expressions with local error:

1.0b
(/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2))))
1.0b
(/ 1 (sqrt (sqrt 2)))
0.4b
(* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2)))
0.3b
(* (/ (cos th) (fabs (cbrt (sqrt 2)))) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2))))

rewrite77.0ms

Algorithm
rewrite-expression-head
Counts
4 → 196
Calls

4 calls. Slowest were:

36.0ms
(* (/ (cos th) (fabs (cbrt (sqrt 2)))) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2))))
22.0ms
(* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2)))
10.0ms
(/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2))))

series1.5s

Counts
4 → 8
Calls

4 calls. Slowest were:

1.1s
(* (/ (cos th) (fabs (cbrt (sqrt 2)))) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2))))
458.0ms
(* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (fma a1 a1 (* a2 a2)))
0.0ms
(/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2))))
0.0ms
(/ 1 (sqrt (sqrt 2)))

simplify9.9s

Counts
190 → 204
Calls

190 calls. Slowest were:

484.0ms
(* (/ (* (* (cos th) (cos th)) (cos th)) (* (* (fabs (cbrt (sqrt 2))) (fabs (cbrt (sqrt 2)))) (fabs (cbrt (sqrt 2))))) (* (/ (* (* (/ 1 (sqrt (sqrt 2))) (/ 1 (sqrt (sqrt 2)))) (/ 1 (sqrt (sqrt 2)))) (* (* (sqrt (cbrt (sqrt 2))) (sqrt (cbrt (sqrt 2)))) (sqrt (cbrt (sqrt 2))))) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2)))))
474.0ms
(+ (- (log (cos th)) (log (fabs (cbrt (sqrt 2))))) (+ (log (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2))))) (log (fma a1 a1 (* a2 a2)))))
443.0ms
(* (/ (cos th) (fabs (cbrt (sqrt 2)))) (* (* a2 a2) (/ (/ 1 (sqrt (sqrt 2))) (sqrt (cbrt (sqrt 2))))))

prune3.7s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0b

localize17.0ms

Local error

Found 4 expressions with local error:

1.0b
(/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2)))
1.0b
(/ 1 (sqrt (sqrt 2)))
0.4b
(* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
0.1b
(* (cos th) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2))))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 153
Calls

4 calls. Slowest were:

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

series220.0ms

Counts
4 → 8
Calls

4 calls. Slowest were:

169.0ms
(* (cos th) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2))))
51.0ms
(* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
0.0ms
(/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2)))
0.0ms
(/ 1 (sqrt (sqrt 2)))

simplify7.1s

Counts
137 → 161
Calls

137 calls. Slowest were:

516.0ms
(* (cos th) (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2))))
512.0ms
(* (* (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2))) (* a2 a2)) (cos th))
481.0ms
(* (cos th) (* (* a2 a2) (/ (/ 1 (sqrt (sqrt 2))) (sqrt (sqrt 2)))))

prune2.4s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

regimes487.0ms

Accuracy

0% (0.4b remaining)

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

bsearch4.0ms