Average Error: 15.1 → 1.3
Time: 50.7s
Precision: 64
Internal Precision: 128
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\]
\[e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\]

Error

Bits error versus K

Bits error versus m

Bits error versus n

Bits error versus M

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.1

    \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\]
  2. Taylor expanded around 0 1.3

    \[\leadsto \color{blue}{1} \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\]
  3. Final simplification1.3

    \[\leadsto e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\]

Reproduce

herbie shell --seed 2019005 +o rules:numerics
(FPCore (K m n M l)
  :name "Maksimov and Kolovsky, Equation (32)"
  (* (cos (- (/ (* K (+ m n)) 2) M)) (exp (- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n)))))))

Details

Time bar (total: 49.5s)Debug log

sample90.0ms

Algorithm
intervals

simplify131.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

130.0ms
(* (cos (- (/ (* K (+ m n)) 2) M)) (exp (- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))))

prune22.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.5b

localize62.0ms

Local error

Found 4 expressions with local error:

34.4b
(cos (- (/ (* K (+ m n)) 2) M))
0.0b
(pow (- (/ (+ m n) 2) M) 2)
0.0b
(/ (* K (+ m n)) 2)
0.0b
(* K (+ m n))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

12.0ms
(cos (- (/ (* K (+ m n)) 2) M))
11.0ms
(pow (- (/ (+ m n) 2) M) 2)
6.0ms
(/ (* K (+ m n)) 2)

series183.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(cos (- (/ (* K (+ m n)) 2) M))
54.0ms
(pow (- (/ (+ m n) 2) M) 2)
40.0ms
(/ (* K (+ m n)) 2)
29.0ms
(* K (+ m n))

simplify1.4s

Counts
29 → 72
Calls

29 calls. Slowest were:

206.0ms
(- (pow M 2) (+ (* m M) (* M n)))
184.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
176.0ms
(- (pow M 2) (+ (* m M) (* M n)))

prune1.5s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.7b

localize7.0ms

Local error

Found 2 expressions with local error:

0.0b
(pow (- (/ (+ m n) 2) M) 2)
0.0b
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))

rewrite150.0ms

Algorithm
rewrite-expression-head
Counts
2 → 110
Calls

2 calls. Slowest were:

137.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
11.0ms
(pow (- (/ (+ m n) 2) M) 2)

series163.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

123.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
41.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify30.9s

Counts
143 → 116
Calls

143 calls. Slowest were:

715.0ms
(fma (- (* (cbrt (pow (- (/ (+ m n) 2) M) 2)) (cbrt (pow (- (/ (+ m n) 2) M) 2)))) (cbrt (pow (- (/ (+ m n) 2) M) 2)) (- (* (- l (fabs (- m n))) 1)))
600.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
566.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))

prune1.9s

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.7b

localize16.0ms

Local error

Found 4 expressions with local error:

34.5b
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
1.2b
(/ 2 (* K (+ m n)))
0.5b
(/ 1 (/ 2 (* K (+ m n))))
0.0b
(pow (- (/ (+ m n) 2) M) 2)

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

11.0ms
(pow (- (/ (+ m n) 2) M) 2)
9.0ms
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
2.0ms
(/ 1 (/ 2 (* K (+ m n))))

series179.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
47.0ms
(pow (- (/ (+ m n) 2) M) 2)
41.0ms
(/ 1 (/ 2 (* K (+ m n))))
30.0ms
(/ 2 (* K (+ m n)))

simplify1.5s

Counts
31 → 77
Calls

31 calls. Slowest were:

193.0ms
(- (pow M 2) (+ (* m M) (* M n)))
170.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
165.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))

prune1.7s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.7b

localize16.0ms

Local error

Found 4 expressions with local error:

34.5b
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
1.2b
(/ 2 (* K (+ m n)))
0.6b
(log (exp (cos (- (/ 1 (/ 2 (* K (+ m n)))) M))))
0.5b
(/ 1 (/ 2 (* K (+ m n))))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

19.0ms
(log (exp (cos (- (/ 1 (/ 2 (* K (+ m n)))) M))))
11.0ms
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
2.0ms
(/ 1 (/ 2 (* K (+ m n))))

series220.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
72.0ms
(log (exp (cos (- (/ 1 (/ 2 (* K (+ m n)))) M))))
34.0ms
(/ 2 (* K (+ m n)))
33.0ms
(/ 1 (/ 2 (* K (+ m n))))

simplify2.9s

Counts
36 → 81
Calls

36 calls. Slowest were:

234.0ms
(sqrt (cos (- (/ 1 (/ 2 (* K (+ m n)))) M)))
227.0ms
(cos (- (/ 1 (/ 2 (* K (+ m n)))) M))
220.0ms
(log (* (cbrt (exp (cos (- (/ 1 (/ 2 (* K (+ m n)))) M)))) (cbrt (exp (cos (- (/ 1 (/ 2 (* K (+ m n)))) M))))))

prune1.7s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.7b

regimes460.0ms

Accuracy

0% (0.2b remaining)

Error of 1.3b against oracle of 1.1b and baseline of 1.3b

bsearch4.0ms

end0.0ms

sample4.0s

Algorithm
intervals