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

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 div-inv0.6

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

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

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

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

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

Reproduce

herbie shell --seed 2018362 +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: 27.8s)Debug log

start368.0ms

Algorithm
intervals

setup107.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.5b

localize21.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:

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

series200.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

160.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
40.0ms
(/ (cos th) (sqrt 2))

simplify1.3s

Counts
54 → 69
Calls

54 calls. Slowest were:

283.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
159.0ms
(- (+ (/ 1 (sqrt 2)) (* 1/24 (/ (pow th 4) (sqrt 2)))) (* 1/2 (/ (pow th 2) (sqrt 2))))
130.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))))

prune995.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 3 expressions with local error:

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

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
3 → 69
Calls

3 calls. Slowest were:

20.0ms
(* (cos th) (* (/ 1 (sqrt 2)) (fma a1 a1 (* a2 a2))))
9.0ms
(* (/ 1 (sqrt 2)) (fma a1 a1 (* a2 a2)))
2.0ms
(/ 1 (sqrt 2))

series298.0ms

Counts
3 → 7
Calls

3 calls. Slowest were:

215.0ms
(* (cos th) (* (/ 1 (sqrt 2)) (fma a1 a1 (* a2 a2))))
83.0ms
(* (/ 1 (sqrt 2)) (fma a1 a1 (* a2 a2)))
0.0ms
(/ 1 (sqrt 2))

simplify3.4s

Counts
39 → 76
Calls

39 calls. Slowest were:

590.0ms
(* (* (* (/ 1 (sqrt 2)) (/ 1 (sqrt 2))) (/ 1 (sqrt 2))) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
428.0ms
(* (cos th) (* (* a2 a2) (/ 1 (sqrt 2))))
288.0ms
(+ (log (cos th)) (log (* (/ 1 (sqrt 2)) (fma a1 a1 (* a2 a2)))))

prune1.2s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

localize11.0ms

Local error

Found 2 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
2 → 61
Calls

2 calls. Slowest were:

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

series243.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

164.0ms
(* (cos th) (/ (fma a1 a1 (* a2 a2)) (sqrt 2)))
79.0ms
(/ (fma a1 a1 (* a2 a2)) (sqrt 2))

simplify1.3s

Counts
52 → 67
Calls

52 calls. Slowest were:

316.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (/ (fma a1 a1 (* a2 a2)) (sqrt 2)) (/ (fma a1 a1 (* a2 a2)) (sqrt 2))) (/ (fma a1 a1 (* a2 a2)) (sqrt 2))))
157.0ms
(/ (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
78.0ms
(+ (/ (* (pow a1 2) (cos th)) (sqrt 2)) (/ (* (cos th) (pow a2 2)) (sqrt 2)))

prune989.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

localize23.0ms

Local error

Found 4 expressions with local error:

6.6b
(sqrt (fma a1 a1 (* a2 a2)))
0.5b
(/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))
0.3b
(/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2)))))
0.2b
(* (cos th) (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
4 → 258
Calls

4 calls. Slowest were:

8.0ms
(* (cos th) (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))))
6.0ms
(/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2)))))
4.0ms
(/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))

series456.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

237.0ms
(* (cos th) (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))))
139.0ms
(/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2)))))
56.0ms
(/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))
24.0ms
(sqrt (fma a1 a1 (* a2 a2)))

simplify12.1s

Counts
306 → 270
Calls

306 calls. Slowest were:

853.0ms
(/ (* (cbrt (hypot a1 a2)) (cbrt (hypot a1 a2))) (/ (* (cbrt (sqrt 2)) (cbrt (sqrt 2))) (* (cbrt (sqrt (fma a1 a1 (* a2 a2)))) (cbrt (sqrt (fma a1 a1 (* a2 a2)))))))
595.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2))))) (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2)))))) (/ (hypot a1 a2) (/ (sqrt 2) (sqrt (fma a1 a1 (* a2 a2)))))))
439.0ms
(/ (hypot a1 a2) (/ (cbrt (sqrt 2)) (sqrt (sqrt (fma a1 a1 (* a2 a2))))))

prune4.2s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

regimes544.0ms

Accuracy

0% (0.5b remaining)

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

bsearch4.0ms