Average Error: 15.3 → 1.4
Time: 25.5s
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 
(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: 24.3s)Debug log

sample133.0ms

Algorithm
intervals

simplify109.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
109.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

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

rewrite104.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
add-log-exp
add-sqr-sqrt
add-cube-cbrt
add-exp-log
pow1
add-cbrt-cube
sub-neg
unpow-prod-down
distribute-lft-out--
associate--r+
flip--
diff-log
flip3--
cos-sum
difference-of-squares
associate--r-
unpow2
pow-exp
neg-log
distribute-rgt-neg-in
pow-pow
pow-to-exp
cos-diff
neg-sub0
associate--l-
Counts
4 → 55
Calls
4 calls:
Slowest
83.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
8.0ms
(pow (- (/ (+ m n) 2) M) 2)
7.0ms
(- (/ (* K (+ m n)) 2) M)
6.0ms
(cos (- (/ (* K (+ m n)) 2) M))

series285.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
101.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
81.0ms
(cos (- (/ (* K (+ m n)) 2) M))
54.0ms
(- (/ (* K (+ m n)) 2) M)
49.0ms
(pow (- (/ (+ m n) 2) M) 2)

simplify2.7s

Counts
29 → 67
Calls
29 calls:
Slowest
322.0ms
(/ (/ 1 (exp (pow (- (/ (+ m n) 2) M) 2))) (exp (- l (fabs (- m n)))))
314.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
292.0ms
(- (sqrt (- (pow (- (/ (+ m n) 2) M) 2))) (sqrt (- l (fabs (- m n)))))
244.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
210.0ms
(/ (exp (- (pow (- (/ (+ m n) 2) M) 2))) (exp (- l (fabs (- m n)))))

prune1.3s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.8b

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

rewrite141.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
add-log-exp
add-sqr-sqrt
add-cube-cbrt
add-exp-log
unpow-prod-down
pow1
distribute-lft-out--
associate--r+
diff-log
add-cbrt-cube
sub-neg
difference-of-squares
associate--r-
unpow2
flip--
pow-exp
neg-log
flip3--
distribute-rgt-neg-in
pow-pow
pow-to-exp
neg-sub0
associate--l-
Counts
2 → 34
Calls
2 calls:
Slowest
135.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
5.0ms
(pow (- (/ (+ m n) 2) M) 2)

series172.0ms

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

simplify2.1s

Counts
20 → 40
Calls
20 calls:
Slowest
394.0ms
(/ (/ 1 (exp (pow (- (/ (+ m n) 2) M) 2))) (exp (- l (fabs (- m n)))))
299.0ms
(/ (exp (- (pow (- (/ (+ m n) 2) M) 2))) (exp (- l (fabs (- m n)))))
220.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))
217.0ms
(- (sqrt (- (pow (- (/ (+ m n) 2) M) 2))) (sqrt (- l (fabs (- m n)))))
212.0ms
(- (- (pow (- (/ (+ m n) 2) M) 2)) (- l (fabs (- m n))))

prune646.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.8b

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

rewrite30.0ms

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

series886.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
285.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
269.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
259.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
73.0ms
(cos (* (* (cbrt (- (/ (* K (+ m n)) 2) M)) (cbrt (- (/ (* K (+ m n)) 2) M))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify3.7s

Counts
27 → 58
Calls
27 calls:
Slowest
436.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
333.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
318.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
251.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))))))))))
220.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.6s

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 (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))) (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))

rewrite178.0ms

Algorithm
rewrite-expression-head
Rules
cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
cbrt-div
add-log-exp
add-exp-log
add-cbrt-cube
pow1
flip--
pow1/3
flip3--
Counts
4 → 46
Calls
4 calls:
Slowest
172.0ms
(cos (* (* (* (* (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))) (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))

series753.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
240.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
222.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
218.0ms
(cbrt (- (/ (* K (+ m n)) 2) M))
73.0ms
(cos (* (* (* (* (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))) (cbrt (- (/ (* K (+ m n)) 2) M))))

simplify3.7s

Counts
27 → 58
Calls
27 calls:
Slowest
395.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
393.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
296.0ms
(exp (* 1/3 (- (log 1/2) (+ (log (/ 1 m)) (log (/ 1 K))))))
249.0ms
(cbrt (- (pow (/ (* K (+ m n)) 2) 3) (pow M 3)))
233.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.4s

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.8b

regimes405.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.8s

Algorithm
intervals