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

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

Reproduce

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

sample250.0ms

Algorithm
intervals

simplify88.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune13.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize18.0ms

Local error

Found 3 expressions with local error:

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

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
3 → 73
Calls

3 calls. Slowest were:

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

series247.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

174.0ms
(* (/ (cos th) (sqrt 2)) (fma a1 a1 (* a2 a2)))
55.0ms
(/ (cos th) (sqrt 2))
18.0ms
(fma a1 a1 (* a2 a2))

simplify1.2s

Counts
57 → 82
Calls

57 calls. Slowest were:

263.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
196.0ms
(- (+ (/ 1 (sqrt 2)) (* 1/24 (/ (pow th 4) (sqrt 2)))) (* 1/2 (/ (pow th 2) (sqrt 2))))
85.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))))

prune1.1s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0b

localize11.0ms

Local error

Found 3 expressions with local error:

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
3 → 54
Calls

3 calls. Slowest were:

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

series313.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

191.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (sqrt 2))
102.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))
19.0ms
(fma a1 a1 (* a2 a2))

simplify1.1s

Counts
33 → 63
Calls

33 calls. Slowest were:

433.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
115.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)))
93.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)))

prune685.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

localize9.0ms

Local error

Found 4 expressions with local error:

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

rewrite46.0ms

Algorithm
rewrite-expression-head
Counts
4 → 387
Calls

4 calls. Slowest were:

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

series288.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

159.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
51.0ms
(/ (cos th) (sqrt (sqrt 2)))
50.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))
28.0ms
(fma a1 a1 (* a2 a2))

simplify12.0s

Counts
502 → 399
Calls

502 calls. Slowest were:

424.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))))
396.0ms
(- (+ (sqrt (/ 1 (sqrt 2))) (* 1/24 (* (sqrt (/ 1 (sqrt 2))) (pow th 4)))) (* 1/2 (* (sqrt (/ 1 (sqrt 2))) (pow th 2))))
235.0ms
(/ (/ (* (cbrt (cos th)) (cbrt (cos th))) (* (cbrt (sqrt (sqrt 2))) (cbrt (sqrt (sqrt 2))))) (sqrt 1))

prune5.6s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0b

localize5.0ms

Local error

Found 3 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 111
Calls

3 calls. Slowest were:

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

series258.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

165.0ms
(/ (cos th) (/ (sqrt 2) (fma a1 a1 (* a2 a2))))
75.0ms
(/ (sqrt 2) (fma a1 a1 (* a2 a2)))
18.0ms
(fma a1 a1 (* a2 a2))

simplify4.8s

Counts
132 → 120
Calls

132 calls. Slowest were:

371.0ms
(/ (* (cbrt (cos th)) (cbrt (cos th))) (/ (* (cbrt (sqrt 2)) (cbrt (sqrt 2))) (* (cbrt (fma a1 a1 (* a2 a2))) (cbrt (fma a1 a1 (* a2 a2))))))
368.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (/ (sqrt 2) (fma a1 a1 (* a2 a2))) (/ (sqrt 2) (fma a1 a1 (* a2 a2)))) (/ (sqrt 2) (fma a1 a1 (* a2 a2)))))
309.0ms
(/ (* (cbrt (cos th)) (cbrt (cos th))) (/ 1 (* (cbrt (fma a1 a1 (* a2 a2))) (cbrt (fma a1 a1 (* a2 a2))))))

prune1.5s

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0b

regimes326.0ms

Accuracy

0% (0.5b remaining)

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

bsearch2.0ms

end0.0ms

sample8.8s

Algorithm
intervals