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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\cos th \cdot \frac{1}{\sqrt{\sqrt{2}}}}}{\sqrt{1} \cdot \sqrt{\sqrt{2}}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}}\]
  11. 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 \left(a1 \cdot a1\right) + \frac{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}}\]
  12. 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 \left(a1 \cdot a1\right)\right)} + \frac{\cos th \cdot \left(a2 \cdot a2\right)}{\sqrt{2}}\]
  13. Simplified0.5

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

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

Reproduce

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

start380.0ms

Algorithm
intervals

setup114.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.5b

localize34.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 118
Calls

4 calls. Slowest were:

10.0ms
(* (/ (cos th) (sqrt 2)) (* a1 a1))
5.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
3.0ms
(/ (cos th) (sqrt 2))

series236.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

97.0ms
(* (/ (cos th) (sqrt 2)) (* a1 a1))
71.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
36.0ms
(/ (cos th) (sqrt 2))
32.0ms
(/ (cos th) (sqrt 2))

simplify3.7s

Counts
98 → 130
Calls

98 calls. Slowest were:

471.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a1 a1) (* a1 a1)) (* a1 a1)))
406.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a2 a2) (* a2 a2)) (* a2 a2)))
344.0ms
(- (/ (pow a2 2) (sqrt 2)) (* 1/2 (/ (* (pow a2 2) (pow th 2)) (sqrt 2))))

prune1.8s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0b

localize9.0ms

Local error

Found 4 expressions with local error:

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

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

series258.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

79.0ms
(* (/ (cos th) (sqrt 2)) (* a1 a1))
75.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
55.0ms
(* (cos th) (* a2 a2))
48.0ms
(/ (cos th) (sqrt 2))

simplify3.2s

Counts
74 → 111
Calls

74 calls. Slowest were:

427.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a1 a1) (* a1 a1)) (* a1 a1)))
425.0ms
(- (pow a2 2) (* 1/2 (* (pow a2 2) (pow th 2))))
328.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))

prune1.5s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite69.0ms

Algorithm
rewrite-expression-head
Counts
4 → 396
Calls

4 calls. Slowest were:

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

series318.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

104.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (* a1 a1))
83.0ms
(/ (cos th) (sqrt (sqrt 2)))
77.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
54.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))

simplify14.4s

Counts
511 → 408
Calls

511 calls. Slowest were:

720.0ms
(* (* (* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))) (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))) (* (* (* a1 a1) (* a1 a1)) (* a1 a1)))
532.0ms
(/ (/ (* (cbrt (cos th)) (cbrt (cos th))) (sqrt 1)) (* (cbrt (sqrt (sqrt 2))) (cbrt (sqrt (sqrt 2)))))
532.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))))

prune6.7s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize27.0ms

Local error

Found 4 expressions with local error:

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

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 130
Calls

4 calls. Slowest were:

22.0ms
(* (/ 1 (sqrt (sqrt 2))) (* (/ (/ (cos th) (sqrt (sqrt (sqrt 2)))) (sqrt (sqrt (sqrt 2)))) (* a1 a1)))
7.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
4.0ms
(/ (cos th) (sqrt (sqrt (sqrt 2))))

series530.0ms

Counts
4 → 10
Calls

4 calls. Slowest were:

335.0ms
(/ (cos th) (sqrt (sqrt (sqrt 2))))
98.0ms
(* (/ 1 (sqrt (sqrt 2))) (* (/ (/ (cos th) (sqrt (sqrt (sqrt 2)))) (sqrt (sqrt (sqrt 2)))) (* a1 a1)))
96.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
0.0ms
(/ 1 (sqrt (sqrt 2)))

simplify6.6s

Counts
120 → 140
Calls

120 calls. Slowest were:

428.0ms
(+ (log (/ 1 (sqrt (sqrt 2)))) (log (* (/ (/ (cos th) (sqrt (sqrt (sqrt 2)))) (sqrt (sqrt (sqrt 2)))) (* a1 a1))))
406.0ms
(* 1 (* (/ (/ (cos th) (sqrt (sqrt (sqrt 2)))) (sqrt (sqrt (sqrt 2)))) (* a1 a1)))
393.0ms
(+ (- (log (sqrt (sqrt 2)))) (+ (log (/ (/ (cos th) (sqrt (sqrt (sqrt 2)))) (sqrt (sqrt (sqrt 2))))) (log (* a1 a1))))

prune2.5s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0b

regimes578.0ms

Accuracy

0% (0.4b remaining)

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

bsearch5.0ms