Average Error: 15.4 → 1.4
Time: 1.4m
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.4

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

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

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

Reproduce

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

sample140.0ms

Algorithm
intervals

simplify185.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune20.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize51.0ms

Local error

Found 4 expressions with local error:

35.4b
(cos (- (/ (* K (+ m n)) 2) M))
0.0b
(- (/ (* K (+ m n)) 2) M)
0.0b
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
0.0b
(pow (- (/ (+ m n) 2) M) 2)

rewrite160.0ms

Algorithm
rewrite-expression-head
Counts
4 → 139
Calls

4 calls. Slowest were:

133.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
12.0ms
(cos (- (/ (* K (+ m n)) 2) M))
7.0ms
(- (/ (* K (+ m n)) 2) M)

series304.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

135.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
63.0ms
(pow (- (/ (+ m n) 2) M) 2)
57.0ms
(cos (- (/ (* K (+ m n)) 2) M))
49.0ms
(- (/ (* K (+ m n)) 2) M)

simplify34.4s

Counts
155 → 151
Calls

155 calls. Slowest were:

701.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
653.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
600.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))

prune2.6s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.8b

localize3.0ms

Local error

Found 2 expressions with local error:

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

rewrite136.0ms

Algorithm
rewrite-expression-head
Counts
2 → 110
Calls

2 calls. Slowest were:

129.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
5.0ms
(pow (- (/ (+ m n) 2) M) 2)

series176.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

133.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
44.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify30.7s

Counts
143 → 116
Calls

143 calls. Slowest were:

613.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
596.0ms
(fma (sqrt (- (pow (- (/ (+ m n) 2) M) 2))) (sqrt (- (pow (- (/ (+ m n) 2) M) 2))) (- (* (- l (fabs (- m n))) 1)))
592.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))

prune1.7s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.8b

localize30.0ms

Local error

Found 4 expressions with local error:

45.2b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
15.0b
(cbrt (- (/ (* K (+ m n)) 2) M))
15.0b
(cbrt (- (/ (* K (+ m n)) 2) M))
15.0b
(cbrt (- (/ (* K (+ m n)) 2) M))

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

35.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
2.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
2.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))

series620.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

210.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
179.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
176.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
55.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify2.9s

Counts
27 → 66
Calls

27 calls. Slowest were:

243.0ms
(- (exp (* 1/3 (+ (log M) (log -1)))) (+ (* 1/6 (* m (* K (exp (* 1/3 (- (log -1) (* 2 (log M)))))))) (* 1/6 (* K (* n (exp (* 1/3 (- (log -1) (* 2 (log M))))))))))
227.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
222.0ms
(- (exp (* 1/3 (+ (log M) (log -1)))) (+ (* 1/6 (* m (* K (exp (* 1/3 (- (log -1) (* 2 (log M)))))))) (* 1/6 (* K (* n (exp (* 1/3 (- (log -1) (* 2 (log M))))))))))

prune1.3s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.8b

localize12.0ms

Local error

Found 4 expressions with local error:

35.4b
(cos (- (/ (* K (+ m n)) 2) M))
35.4b
(cos (- (/ (* K (+ m n)) 2) M))
35.4b
(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))))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 49
Calls

4 calls. Slowest were:

10.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))

series253.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

77.0ms
(cos (- (/ (* K (+ m n)) 2) M))
64.0ms
(cbrt (* (* (cos (- (/ (* K (+ m n)) 2) M)) (cos (- (/ (* K (+ m n)) 2) M))) (cos (- (/ (* K (+ m n)) 2) M))))
64.0ms
(cos (- (/ (* K (+ m n)) 2) M))
48.0ms
(cos (- (/ (* K (+ m n)) 2) M))

simplify1.8s

Counts
24 → 61
Calls

24 calls. Slowest were:

165.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
159.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))))
154.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))

prune1.2s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.8b

regimes335.0ms

Accuracy

0% (0.2b remaining)

Error of 1.4b against oracle of 1.2b and baseline of 1.4b

bsearch2.0ms

end0.0ms

sample3.7s

Algorithm
intervals