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

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 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}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  4. 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}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  5. Using strategy rm
  6. Applied associate-*l/0.5

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019010 +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: 1.1m)Debug log

sample183.0ms

Algorithm
intervals

simplify76.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
76.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

localize42.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.3b
(* (/ (cos th) (sqrt 2)) (* a1 a1))

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
36×times-frac
34×add-cube-cbrt
34×*-un-lft-identity
34×add-sqr-sqrt
26×associate-*l*
18×add-exp-log
18×add-cbrt-cube
pow1
associate-/l*
associate-/r*
add-log-exp
div-inv
log1p-expm1-u
cbrt-unprod
prod-exp
div-exp
cbrt-undiv
expm1-log1p-u
*-commutative
associate-*l/
pow-prod-down
associate-*r*
frac-2neg
clear-num
Counts
4 → 118
Calls
4 calls:
Slowest
12.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
7.0ms
(* (/ (cos th) (sqrt 2)) (* a1 a1))
7.0ms
(/ (cos th) (sqrt 2))
6.0ms
(/ (cos th) (sqrt 2))

series245.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
79.0ms
(* (/ (cos th) (sqrt 2)) (* a1 a1))
79.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
53.0ms
(/ (cos th) (sqrt 2))
33.0ms
(/ (cos th) (sqrt 2))

simplify3.0s

Counts
98 → 130
Calls
98 calls:
Slowest
351.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a1 a1) (* a1 a1)) (* a1 a1)))
332.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a2 a2) (* a2 a2)) (* a2 a2)))
289.0ms
(- (/ (pow a1 2) (sqrt 2)) (* 1/2 (/ (* (pow a1 2) (pow th 2)) (sqrt 2))))
253.0ms
(- (/ (pow a2 2) (sqrt 2)) (* 1/2 (/ (* (pow a2 2) (pow th 2)) (sqrt 2))))
233.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))

prune1.8s

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 0b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite33.0ms

Algorithm
rewrite-expression-head
Rules
294×times-frac
171×add-cube-cbrt
171×*-un-lft-identity
171×add-sqr-sqrt
144×sqrt-prod
28×associate-/l*
18×add-exp-log
18×add-cbrt-cube
15×associate-/r*
13×associate-*l*
11×div-inv
div-exp
cbrt-undiv
pow1
add-log-exp
log1p-expm1-u
expm1-log1p-u
frac-2neg
clear-num
cbrt-unprod
prod-exp
associate-/l/
*-commutative
associate-*l/
pow-prod-down
associate-*r*
Counts
4 → 277
Calls
4 calls:
Slowest
10.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))
6.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
4.0ms
(/ (cos th) (sqrt (sqrt 2)))
3.0ms
(/ (cos th) (sqrt 2))

series206.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
69.0ms
(* (/ (cos th) (sqrt 2)) (* a2 a2))
52.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))
50.0ms
(/ (cos th) (sqrt (sqrt 2)))
35.0ms
(/ (cos th) (sqrt 2))

simplify8.2s

Counts
397 → 289
Calls
397 calls:
Slowest
407.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))))
399.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (* a2 a2) (* a2 a2)) (* a2 a2)))
333.0ms
(- (+ (sqrt (/ 1 (sqrt 2))) (* 1/24 (* (sqrt (/ 1 (sqrt 2))) (pow th 4)))) (* 1/2 (* (sqrt (/ 1 (sqrt 2))) (pow th 2))))
292.0ms
(- (/ (pow a2 2) (sqrt 2)) (* 1/2 (/ (* (pow a2 2) (pow th 2)) (sqrt 2))))
264.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))

prune4.5s

Pruning

14 alts after pruning (14 fresh and 0 done)

Merged error: 0b

localize14.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.3b
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (* a1 a1))
0.3b
(/ (* (cos th) (* a2 a2)) (sqrt 2))

rewrite57.0ms

Algorithm
rewrite-expression-head
Rules
519×times-frac
281×add-cube-cbrt
281×*-un-lft-identity
281×add-sqr-sqrt
264×sqrt-prod
136×associate-*l*
26×associate-/l*
25×add-exp-log
25×add-cbrt-cube
17×div-inv
15×associate-/r*
div-exp
cbrt-undiv
pow1
add-log-exp
log1p-expm1-u
cbrt-unprod
prod-exp
expm1-log1p-u
frac-2neg
clear-num
associate-/l/
*-commutative
associate-*l/
pow-prod-down
associate-*r*
Counts
4 → 396
Calls
4 calls:
Slowest
15.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (* a1 a1))
15.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))
9.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
7.0ms
(/ (cos th) (sqrt (sqrt 2)))

series235.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
74.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
68.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) (* a1 a1))
51.0ms
(/ (cos th) (sqrt (sqrt 2)))
43.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))

simplify13.5s

Counts
511 → 408
Calls
511 calls:
Slowest
785.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)))
448.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))))
344.0ms
(+ (- (- (log (cos th)) (log (sqrt (sqrt 2)))) (log (sqrt (sqrt 2)))) (log (* a1 a1)))
331.0ms
(+ (log (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))) (log (* a1 a1)))
318.0ms
(- (/ (pow a1 2) (sqrt 2)) (* 1/2 (/ (* (pow a1 2) (pow th 2)) (sqrt 2))))

prune6.4s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0b

localize18.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))) a1)
0.3b
(/ (* (cos th) (* a2 a2)) (sqrt 2))

rewrite57.0ms

Algorithm
rewrite-expression-head
Rules
519×times-frac
281×add-cube-cbrt
281×*-un-lft-identity
281×add-sqr-sqrt
264×sqrt-prod
136×associate-*l*
26×associate-/l*
17×div-inv
16×add-exp-log
16×add-cbrt-cube
15×associate-/r*
div-exp
cbrt-undiv
add-log-exp
log1p-expm1-u
pow1
expm1-log1p-u
frac-2neg
clear-num
associate-/l/
cbrt-unprod
*-commutative
prod-exp
associate-*l/
Counts
4 → 388
Calls
4 calls:
Slowest
18.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))
15.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) a1)
7.0ms
(/ (cos th) (sqrt (sqrt 2)))
7.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))

series329.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
102.0ms
(/ (* (cos th) (* a2 a2)) (sqrt 2))
96.0ms
(* (/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2))) a1)
86.0ms
(/ (cos th) (sqrt (sqrt 2)))
45.0ms
(/ (/ (cos th) (sqrt (sqrt 2))) (sqrt (sqrt 2)))

simplify11.3s

Counts
504 → 400
Calls
504 calls:
Slowest
503.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))))
408.0ms
(- (+ (sqrt (/ 1 (sqrt 2))) (* 1/24 (* (sqrt (/ 1 (sqrt 2))) (pow th 4)))) (* 1/2 (* (sqrt (/ 1 (sqrt 2))) (pow th 2))))
355.0ms
(- (/ a1 (sqrt 2)) (* 1/2 (/ (* a1 (pow th 2)) (sqrt 2))))
274.0ms
(- (/ (pow a2 2) (sqrt 2)) (* 1/2 (/ (* (pow a2 2) (pow th 2)) (sqrt 2))))
236.0ms
(/ (/ (* (cbrt (cos th)) (cbrt (cos th))) (* (cbrt (sqrt (sqrt 2))) (cbrt (sqrt (sqrt 2))))) 1)

prune6.0s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

regimes537.0ms

Accuracy

0% (0.4b remaining)

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

bsearch7.0ms

end0.0ms

sample9.1s

Algorithm
intervals