Average Error: 15.1 → 1.5
Time: 16.9s
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.5

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

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

Reproduce

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

sample109.0ms

Algorithm
intervals

simplify153.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

153.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: 14.5b

localize93.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

10.0ms
(- (/ (* K (+ m n)) 2) M)
7.0ms
(cos (- (/ (* K (+ m n)) 2) M))
6.0ms
(pow (- (/ (+ m n) 2) M) 2)

series166.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(cos (- (/ (* K (+ m n)) 2) M))
42.0ms
(pow (- (/ (+ m n) 2) M) 2)
41.0ms
(- (/ (* K (+ m n)) 2) M)
21.0ms
(* K (+ m n))

simplify1.5s

Counts
30 → 74
Calls

30 calls. Slowest were:

197.0ms
(- (pow M 2) (+ (* m M) (* M n)))
157.0ms
(- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M)
137.0ms
(- (pow M 2) (+ (* m M) (* M n)))

prune1.6s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.6b

localize7.0ms

Local error

Found 2 expressions with local error:

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

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
2 → 33
Calls

2 calls. Slowest were:

13.0ms
(pow (- (/ (+ m n) 2) M) 2)
6.0ms
(- (/ (+ m n) 2) M)

series68.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

44.0ms
(pow (- (/ (+ m n) 2) M) 2)
24.0ms
(- (/ (+ m n) 2) M)

simplify565.0ms

Counts
14 → 39
Calls

14 calls. Slowest were:

146.0ms
(- (pow M 2) (+ (* m M) (* M n)))
113.0ms
(- (pow M 2) (+ (* m M) (* M n)))
87.0ms
(+ (* 1/2 (* m n)) (+ (* 1/4 (pow m 2)) (* 1/4 (pow n 2))))

prune684.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.6b

localize14.0ms

Local error

Found 4 expressions with local error:

33.7b
(cos (- (/ (* K (+ m n)) 2) M))
0.4b
(expm1 (cos (- (/ (* K (+ m n)) 2) M)))
0.3b
(log1p (expm1 (cos (- (/ (* K (+ m n)) 2) M))))
0.0b
(pow (- (/ (+ m n) 2) M) 2)

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 50
Calls

4 calls. Slowest were:

6.0ms
(cos (- (/ (* K (+ m n)) 2) M))
6.0ms
(pow (- (/ (+ m n) 2) M) 2)
0.0ms
(expm1 (cos (- (/ (* K (+ m n)) 2) M)))

series335.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

118.0ms
(expm1 (cos (- (/ (* K (+ m n)) 2) M)))
103.0ms
(log1p (expm1 (cos (- (/ (* K (+ m n)) 2) M))))
73.0ms
(cos (- (/ (* K (+ m n)) 2) M))
40.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify1.6s

Counts
22 → 62
Calls

22 calls. Slowest were:

170.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
161.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
161.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))

prune1.3s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.6b

localize26.0ms

Local error

Found 4 expressions with local error:

33.7b
(cos (- (/ (* K (+ m n)) 2) M))
33.7b
(cos (- (/ (* K (+ m n)) 2) M))
33.7b
(cos (- (/ (* K (+ m n)) 2) M))
0.5b
(cbrt (* (* (cos (- (/ (* K (+ m n)) 2) M)) (cos (- (/ (* K (+ m n)) 2) M))) (cos (- (/ (* K (+ m n)) 2) M))))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 49
Calls

4 calls. Slowest were:

18.0ms
(cbrt (* (* (cos (- (/ (* K (+ m n)) 2) M)) (cos (- (/ (* K (+ m n)) 2) M))) (cos (- (/ (* K (+ m n)) 2) M))))
6.0ms
(cos (- (/ (* K (+ m n)) 2) M))
6.0ms
(cos (- (/ (* K (+ m n)) 2) M))

series256.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

76.0ms
(cos (- (/ (* K (+ m n)) 2) M))
67.0ms
(cbrt (* (* (cos (- (/ (* K (+ m n)) 2) M)) (cos (- (/ (* K (+ m n)) 2) M))) (cos (- (/ (* K (+ m n)) 2) M))))
58.0ms
(cos (- (/ (* K (+ m n)) 2) M))
55.0ms
(cos (- (/ (* K (+ m n)) 2) M))

simplify1.8s

Counts
24 → 61
Calls

24 calls. Slowest were:

211.0ms
(cbrt (* (+ (cos (+ (- (/ (* K (+ m n)) 2) M) (- (/ (* K (+ m n)) 2) M))) (cos (- (- (/ (* K (+ m n)) 2) M) (- (/ (* K (+ m n)) 2) M)))) (cos (- (/ (* K (+ m n)) 2) M))))
181.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
162.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))

prune1.4s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.6b

regimes403.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample3.9s

Algorithm
intervals