Average Error: 15.3 → 1.4
Time: 1.5m
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.3

    \[\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 2019010 +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.5m)Debug log

sample120.0ms

Algorithm
intervals

simplify193.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
193.0ms
(* (cos (- (/ (* K (+ m n)) 2) M)) (exp (- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))))

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.5b

localize43.0ms

Local error

Found 4 expressions with local error:

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

rewrite213.0ms

Algorithm
rewrite-expression-head
Rules
54×prod-diff
48×*-un-lft-identity
46×add-sqr-sqrt
44×add-cube-cbrt
29×distribute-rgt-neg-in
28×distribute-lft-neg-in
27×unpow-prod-down
22×fma-neg
unpow2
add-log-exp
add-exp-log
pow1
log1p-expm1-u
add-cbrt-cube
sub-neg
neg-mul-1
expm1-log1p-u
distribute-lft-out--
associate--r+
flip--
diff-log
flip3--
cos-sum
difference-of-squares
associate--r-
div-inv
pow-exp
neg-log
pow-pow
pow-to-exp
cos-diff
neg-sub0
associate--l-
Counts
4 → 139
Calls
4 calls:
Slowest
188.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
14.0ms
(cos (- (/ (* K (+ m n)) 2) M))
5.0ms
(pow (- (/ (+ m n) 2) M) 2)
4.0ms
(- (/ (* K (+ m n)) 2) M)

series288.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
135.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
64.0ms
(pow (- (/ (+ m n) 2) M) 2)
52.0ms
(cos (- (/ (* K (+ m n)) 2) M))
37.0ms
(- (/ (* K (+ m n)) 2) M)

simplify35.7s

Counts
155 → 151
Calls
155 calls:
Slowest
644.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
642.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
635.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
607.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
599.0ms
(fma (- (pow (sqrt (- (/ (+ m n) 2) M)) 2)) (pow (sqrt (- (/ (+ m n) 2) M)) 2) (- (* (cbrt (- l (fabs (- m n)))) (* (cbrt (- l (fabs (- m n)))) (cbrt (- l (fabs (- m n))))))))

prune2.1s

Pruning

4 alts after pruning (4 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)

rewrite115.0ms

Algorithm
rewrite-expression-head
Rules
54×prod-diff
45×*-un-lft-identity
43×add-sqr-sqrt
41×add-cube-cbrt
29×distribute-rgt-neg-in
28×distribute-lft-neg-in
27×unpow-prod-down
18×fma-neg
unpow2
add-log-exp
neg-mul-1
add-exp-log
pow1
distribute-lft-out--
associate--r+
log1p-expm1-u
diff-log
add-cbrt-cube
sub-neg
expm1-log1p-u
difference-of-squares
associate--r-
flip--
pow-exp
neg-log
flip3--
pow-pow
pow-to-exp
neg-sub0
associate--l-
Counts
2 → 110
Calls
2 calls:
Slowest
107.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
6.0ms
(pow (- (/ (+ m n) 2) M) 2)

series130.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
90.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
39.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify33.6s

Counts
143 → 116
Calls
143 calls:
Slowest
668.0ms
(* (cbrt (- (pow (- (/ (+ m n) 2) M) 2))) (cbrt (- (pow (- (/ (+ m n) 2) M) 2))))
665.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
610.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
596.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))
592.0ms
(fma (- (- l (fabs (- m n)))) 1 (* (- l (fabs (- m n))) 1))

prune1.7s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.8b

localize23.0ms

Local error

Found 4 expressions with local error:

45.8b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
cbrt-div
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
flip--
pow1/3
flip3--
Counts
4 → 54
Calls
4 calls:
Slowest
27.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))
2.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))

series868.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
289.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
274.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
242.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
63.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify3.8s

Counts
27 → 66
Calls
27 calls:
Slowest
303.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))))))))))
296.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
266.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
265.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))))))))))
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))))))))))

prune1.5s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.8b

localize36.0ms

Local error

Found 4 expressions with local error:

47.5b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (* (* (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M)))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))))) (cbrt (- (/ (* K (+ m n)) 2) M))))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))
12.6b
(cbrt (- (/ (* K (+ m n)) 2) M))

rewrite296.0ms

Algorithm
rewrite-expression-head
Rules
cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
cbrt-div
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
flip--
pow1/3
flip3--
Counts
4 → 54
Calls
4 calls:
Slowest
288.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (* (* (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M)))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))))) (cbrt (- (/ (* K (+ m n)) 2) M))))
3.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
2.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
2.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))

series816.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
272.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
243.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
229.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
71.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (* (* (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M)))) (cbrt (cbrt (- (/ (* K (+ m n)) 2) M))))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify3.8s

Counts
27 → 66
Calls
27 calls:
Slowest
288.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))))))))))
277.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))))))))))
273.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
253.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 (- (* (/ (* K (+ m n)) 2) (/ (* K (+ m n)) 2)) (* M M)))

prune1.5s

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.8b

regimes547.0ms

Accuracy

0% (0.3b remaining)

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

bsearch4.0ms

end0.0ms

sample3.7s

Algorithm
intervals