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

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

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

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

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

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

Reproduce

herbie shell --seed 2019008 
(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: 33.8s)Debug log

sample201.0ms

Algorithm
intervals

simplify101.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune25.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize23.0ms

Local error

Found 3 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
3 → 74
Calls

3 calls. Slowest were:

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

series245.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

184.0ms
(* (/ (cos th) (sqrt 2)) (+ (* a1 a1) (* a2 a2)))
35.0ms
(/ (cos th) (sqrt 2))
25.0ms
(+ (* a1 a1) (* a2 a2))

simplify2.8s

Counts
64 → 83
Calls

64 calls. Slowest were:

427.0ms
(* (cos th) (- (* (* a1 a1) (* a1 a1)) (* (* a2 a2) (* a2 a2))))
358.0ms
(* (sqrt 2) (- (* a1 a1) (* a2 a2)))
295.0ms
(* (/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2))) (* (* (+ (* a1 a1) (* a2 a2)) (+ (* a1 a1) (* a2 a2))) (+ (* a1 a1) (* a2 a2))))

prune915.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0b

localize11.0ms

Local error

Found 3 expressions with local error:

0.4b
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
0.2b
(* (cos th) (+ (* a1 a1) (* a2 a2)))
0.0b
(+ (* a1 a1) (* a2 a2))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
3 → 55
Calls

3 calls. Slowest were:

15.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
13.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))
4.0ms
(+ (* a1 a1) (* a2 a2))

series291.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

166.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (sqrt 2))
106.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))
19.0ms
(+ (* a1 a1) (* a2 a2))

simplify1.7s

Counts
38 → 64
Calls

38 calls. Slowest were:

412.0ms
(* (cos th) (- (* (* a1 a1) (* a1 a1)) (* (* a2 a2) (* a2 a2))))
205.0ms
(/ (* (* (* (cos th) (cos th)) (cos th)) (* (* (+ (* a1 a1) (* a2 a2)) (+ (* a1 a1) (* a2 a2))) (+ (* a1 a1) (* a2 a2)))) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
175.0ms
(+ (* (* a1 a1) (* a1 a1)) (- (* (* a2 a2) (* a2 a2)) (* (* a1 a1) (* a2 a2))))

prune675.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize11.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
0.2b
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
0.2b
(* (cos th) (+ (* a1 a1) (* a2 a2)))
0.0b
(+ (* a1 a1) (* a2 a2))

rewrite67.0ms

Algorithm
rewrite-expression-head
Counts
4 → 117
Calls

4 calls. Slowest were:

30.0ms
(/ (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
19.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
11.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))

series1.2s

Counts
4 → 12
Calls

4 calls. Slowest were:

855.0ms
(/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))
189.0ms
(/ (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (cbrt (sqrt 2)))
107.0ms
(* (cos th) (+ (* a1 a1) (* a2 a2)))
15.0ms
(+ (* a1 a1) (* a2 a2))

simplify10.6s

Counts
120 → 129
Calls

120 calls. Slowest were:

567.0ms
(/ (* (* (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (/ (* (cos th) (+ (* a1 a1) (* a2 a2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (sqrt 2))
428.0ms
(* (cos th) (- (* (* a1 a1) (* a1 a1)) (* (* a2 a2) (* a2 a2))))
333.0ms
(/ (/ (* (* (* (cos th) (cos th)) (cos th)) (* (* (+ (* a1 a1) (* a2 a2)) (+ (* a1 a1) (* a2 a2))) (+ (* a1 a1) (* a2 a2)))) (* (* (* (cbrt (sqrt 2)) (cbrt (sqrt 2))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2)))) (* (cbrt (sqrt 2)) (cbrt (sqrt 2))))) (sqrt 2))

prune1.7s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

localize14.0ms

Local error

Found 4 expressions with local error:

4.7b
(sqrt (+ (* a1 a1) (* a2 a2)))
4.7b
(sqrt (+ (* a1 a1) (* a2 a2)))
0.7b
(/ (cos th) (sqrt 2))
0.4b
(* (/ (cos th) (sqrt 2)) (sqrt (+ (* a1 a1) (* a2 a2))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 92
Calls

4 calls. Slowest were:

8.0ms
(* (/ (cos th) (sqrt 2)) (sqrt (+ (* a1 a1) (* a2 a2))))
3.0ms
(/ (cos th) (sqrt 2))
2.0ms
(sqrt (+ (* a1 a1) (* a2 a2)))

series268.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

167.0ms
(* (/ (cos th) (sqrt 2)) (sqrt (+ (* a1 a1) (* a2 a2))))
42.0ms
(/ (cos th) (sqrt 2))
31.0ms
(sqrt (+ (* a1 a1) (* a2 a2)))
28.0ms
(sqrt (+ (* a1 a1) (* a2 a2)))

simplify2.4s

Counts
79 → 104
Calls

79 calls. Slowest were:

486.0ms
(* (* (* (/ (cos th) (sqrt 2)) (/ (cos th) (sqrt 2))) (/ (cos th) (sqrt 2))) (* (* (sqrt (+ (* a1 a1) (* a2 a2))) (sqrt (+ (* a1 a1) (* a2 a2)))) (sqrt (+ (* a1 a1) (* a2 a2)))))
250.0ms
(/ (* (* (cos th) (cos th)) (cos th)) (* (* (sqrt 2) (sqrt 2)) (sqrt 2)))
195.0ms
(* (sqrt 2) (sqrt (+ (* (* a1 a1) (* a1 a1)) (- (* (* a2 a2) (* a2 a2)) (* (* a1 a1) (* a2 a2))))))

prune1.3s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

regimes531.0ms

Accuracy

0% (0.4b remaining)

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

bsearch2.0ms

end0.0ms

sample8.6s

Algorithm
intervals