Average Error: 15.2 → 1.5
Time: 19.8s
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.2

    \[\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 2019008 +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: 18.6s)Debug log

sample122.0ms

Algorithm
intervals

simplify134.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune21.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 17.4b

localize93.0ms

Local error

Found 4 expressions with local error:

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

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

13.0ms
(cos (- (/ (* K (+ m n)) 2) M))
11.0ms
(pow (- (/ (+ m n) 2) M) 2)
8.0ms
(- (/ (* K (+ m n)) 2) M)

series159.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(cos (- (/ (* K (+ m n)) 2) M))
47.0ms
(pow (- (/ (+ m n) 2) M) 2)
36.0ms
(- (/ (* K (+ m n)) 2) M)
16.0ms
(* K (+ m n))

simplify1.5s

Counts
30 → 74
Calls

30 calls. Slowest were:

187.0ms
(- (pow M 2) (+ (* m M) (* M n)))
148.0ms
(cos (- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M))
137.0ms
(- (+ (* 1/2 (* m K)) (* 1/2 (* K n))) M)

prune1.4s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 1.4b

localize3.0ms

Local error

Found 1 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
1 → 16
Calls

1 calls. Slowest were:

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

series42.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

42.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify424.0ms

Counts
8 → 19
Calls

8 calls. Slowest were:

166.0ms
(- (pow M 2) (+ (* m M) (* M n)))
111.0ms
(- (pow M 2) (+ (* m M) (* M n)))
93.0ms
(+ (* 1/2 (* m n)) (+ (* 1/4 (pow m 2)) (* 1/4 (pow n 2))))

prune395.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 1.4b

localize18.0ms

Local error

Found 4 expressions with local error:

44.2b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
15.7b
(cbrt (- (/ (* K (+ m n)) 2) M))
15.7b
(cbrt (- (/ (* K (+ m n)) 2) M))
15.7b
(cbrt (- (/ (* K (+ m n)) 2) M))

rewrite46.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

32.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
4.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
4.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))

series823.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

252.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
249.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
230.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
92.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify3.5s

Counts
27 → 66
Calls

27 calls. Slowest were:

306.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))))))))))
248.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))))))))))
238.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: 1.4b

localize30.0ms

Local error

Found 4 expressions with local error:

44.2b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
44.2b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
44.2b
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
15.7b
(cbrt (- (/ (* K (+ m n)) 2) M))

rewrite107.0ms

Algorithm
rewrite-expression-head
Counts
4 → 42
Calls

4 calls. Slowest were:

46.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
29.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
26.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

series418.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

227.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
69.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
66.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))
56.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify2.0s

Counts
17 → 54
Calls

17 calls. Slowest were:

283.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))))))))))
214.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
201.0ms
(cbrt (- (* (/ (* K (+ m n)) 2) (/ (* K (+ m n)) 2)) (* M M)))

prune1.6s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 1.4b

regimes487.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms

end0.0ms

sample3.8s

Algorithm
intervals