Average Error: 0.6 → 0.5
Time: 38.9s
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}}} + \frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}}\]

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 (a1 \cdot a1 + \left(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 (a1 \cdot a1 + \left(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 (a1 \cdot a1 + \left(a2 \cdot a2\right))_*\]
  6. Using strategy rm
  7. Applied fma-udef0.6

    \[\leadsto \frac{\frac{\cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\sqrt[3]{\sqrt{2}}} \cdot \color{blue}{\left(a1 \cdot a1 + a2 \cdot a2\right)}\]
  8. 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)}\]
  9. 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}}}\]
  10. 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}}} + \frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}}\]

Reproduce

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

sample234.0ms

Algorithm
intervals

simplify104.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune21.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.7b

localize44.0ms

Local error

Found 2 expressions with local error:

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

rewrite20.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))

series204.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify1.3s

Counts
54 → 69
Calls

54 calls. Slowest were:

315.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
153.0ms
(- (+ (/ 1 (sqrt 2)) (* 1/24 (/ (pow th 4) (sqrt 2)))) (* 1/2 (/ (pow th 2) (sqrt 2))))
98.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.3s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.2b

localize11.0ms

Local error

Found 2 expressions with local error:

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

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
2 → 44
Calls

2 calls. Slowest were:

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

series302.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

187.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (sqrt 2))
115.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))

simplify958.0ms

Counts
30 → 50
Calls

30 calls. Slowest were:

374.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
97.0ms
(+ (/ (* (pow a1 2) (cos th)) (sqrt 2)) (/ (* (cos th) (pow a2 2)) (sqrt 2)))
87.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)))

prune718.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.2b

localize21.0ms

Local error

Found 3 expressions with local error:

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

rewrite55.0ms

Algorithm
rewrite-expression-head
Counts
3 → 108
Calls

3 calls. Slowest were:

26.0ms
(/ (/ (* (cos th) (fma a1 a1 (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
19.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
7.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))

series1.2s

Counts
3 → 9
Calls

3 calls. Slowest were:

869.0ms
(/ (* (cos th) (fma a1 a1 (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
180.0ms
(/ (/ (* (cos th) (fma a1 a1 (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
113.0ms
(* (cos th) (fma a1 a1 (* a2 a2)))

simplify10.7s

Counts
112 → 117
Calls

112 calls. Slowest were:

508.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))
470.0ms
(* (* (* (cos th) (cos th)) (cos th)) (* (* (fma a1 a1 (* a2 a2)) (fma a1 a1 (* a2 a2))) (fma a1 a1 (* a2 a2))))
437.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)))

prune1.6s

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.2b

localize9.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))) (fma a1 a1 (* a2 a2)))
0.1b
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
3 → 168
Calls

3 calls. Slowest were:

19.0ms
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
17.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
6.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))

series709.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

483.0ms
(/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
172.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (fma a1 a1 (* a2 a2)))
54.0ms
(/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))

simplify6.4s

Counts
185 → 177
Calls

185 calls. Slowest were:

432.0ms
(+ (- (- (log (cos th)) (log (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (log (cbrt (sqrt 2)))) (log (fma a1 a1 (* a2 a2))))
407.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))
353.0ms
(* (/ (/ (cos th) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2))) (fma a1 a1 (* a2 a2)))

prune2.4s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.0b

regimes568.0ms

Accuracy

0% (0.4b remaining)

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

bsearch3.0ms

end0.0ms

sample8.9s

Algorithm
intervals