Average Error: 29.1 → 0.8
Time: 1.3m
Precision: 64
Internal Precision: 128
\[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
\[\begin{array}{l} \mathbf{if}\;x \le 180.4311795083586:\\ \;\;\;\;\frac{\left(2 + \frac{2}{3} \cdot {x}^{3}\right) - {x}^{2}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) \cdot e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - e^{-\log \left(e^{x \cdot \left(1 + \varepsilon\right)}\right)} \cdot \left(\frac{1}{\varepsilon} - 1\right)}{2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 180.4311795083586

    1. Initial program 39.0

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
    2. Taylor expanded around 0 1.1

      \[\leadsto \frac{\color{blue}{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2}}}{2}\]

    if 180.4311795083586 < x

    1. Initial program 0.1

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

      \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\color{blue}{\log \left(e^{\left(1 + \varepsilon\right) \cdot x}\right)}}}{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 180.4311795083586:\\ \;\;\;\;\frac{\left(2 + \frac{2}{3} \cdot {x}^{3}\right) - {x}^{2}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) \cdot e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - e^{-\log \left(e^{x \cdot \left(1 + \varepsilon\right)}\right)} \cdot \left(\frac{1}{\varepsilon} - 1\right)}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019010 
(FPCore (x eps)
  :name "NMSE Section 6.1 mentioned, A"
  (/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2))

Details

Time bar (total: 1.3m)Debug log

sample472.0ms

Algorithm
intervals

simplify544.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
544.0ms
(/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2)

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.3b

localize50.0ms

Local error

Found 4 expressions with local error:

0.5b
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
0.0b
(* (+ 1 eps) x)
0.0b
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
0.0b
(* (- 1 eps) x)

rewrite59.0ms

Algorithm
rewrite-expression-head
Rules
81×frac-sub
76×frac-times
76×exp-neg
57×exp-diff
57×neg-sub0
42×associate-*l/
38×associate-*r/
31×flip-+
31×flip3-+
29×flip--
29×flip3--
19×un-div-inv
associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-cbrt-cube
pow1
add-exp-log
*-commutative
associate-*r*
cbrt-unprod
prod-exp
pow-prod-down
diff-log
sub-neg
Counts
4 → 145
Calls
4 calls:
Slowest
32.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
14.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
5.0ms
(* (- 1 eps) x)
5.0ms
(* (+ 1 eps) x)

series177.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
116.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
31.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
17.0ms
(* (+ 1 eps) x)
14.0ms
(* (- 1 eps) x)

simplify45.4s

Counts
204 → 157
Calls
204 calls:
Slowest
613.0ms
(* (* (* (+ 1 (/ 1 eps)) (+ 1 (/ 1 eps))) (+ 1 (/ 1 eps))) (* (* (exp (- (* (- 1 eps) x))) (exp (- (* (- 1 eps) x)))) (exp (- (* (- 1 eps) x)))))
605.0ms
(* (- 1 (/ 1 eps)) (+ (* (/ 1 eps) (/ 1 eps)) (+ (* 1 1) (* (/ 1 eps) 1))))
591.0ms
(sqrt (exp (- (* (- 1 eps) x))))
559.0ms
(- (* (* (+ 1 (/ 1 eps)) 1) (* (+ (* (/ 1 eps) (/ 1 eps)) (+ (* 1 1) (* (/ 1 eps) 1))) (exp (* (+ 1 eps) x)))) (* (exp (* (- 1 eps) x)) (* (- (pow (/ 1 eps) 3) (pow 1 3)) (exp 0))))
553.0ms
(* (exp (* (- 1 eps) x)) (+ (/ 1 eps) 1))

prune2.8s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize31.0ms

Local error

Found 2 expressions with local error:

5.8b
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
0.1b
(* 2/3 (pow x 3))

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
associate-*r*
*-un-lft-identity
add-log-exp
add-cube-cbrt
difference-of-squares
add-exp-log
add-cbrt-cube
pow1
unpow2
distribute-lft-out--
flip--
*-commutative
associate--l+
unpow3
diff-log
flip3--
sub-neg
cube-mult
Counts
2 → 29
Calls
2 calls:
Slowest
22.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
2.0ms
(* 2/3 (pow x 3))

series53.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
31.0ms
(* 2/3 (pow x 3))
22.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify393.0ms

Counts
17 → 35
Calls
17 calls:
Slowest
73.0ms
(/ (exp (+ (* 2/3 (pow x 3)) 2)) (exp (pow x 2)))
64.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
59.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
43.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
42.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune349.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.3b

localize24.0ms

Local error

Found 4 expressions with local error:

10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
5.8b
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

rewrite67.0ms

Algorithm
rewrite-expression-head
Rules
19×add-sqr-sqrt
18×cbrt-prod
15×*-un-lft-identity
difference-of-squares
add-cube-cbrt
add-log-exp
cbrt-div
unpow2
distribute-lft-out--
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
pow1/3
associate--l+
diff-log
sub-neg
Counts
4 → 64
Calls
4 calls:
Slowest
28.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
13.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
12.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
12.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))

series230.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
85.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
66.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
53.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
26.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify5.2s

Counts
43 → 76
Calls
43 calls:
Slowest
508.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
444.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
432.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
318.0ms
(- (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (+ (* 1/4 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (pow x 2))) (* 1/2 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) x))))
311.0ms
(- (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (+ (* 1/4 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (pow x 2))) (* 1/2 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) x))))

prune631.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.3b

localize30.0ms

Local error

Found 4 expressions with local error:

10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
10.5b
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
24×cbrt-prod
20×add-sqr-sqrt
16×*-un-lft-identity
difference-of-squares
add-cube-cbrt
cbrt-div
add-log-exp
unpow2
distribute-lft-out--
flip--
add-exp-log
pow1/3
add-cbrt-cube
flip3--
pow1
Counts
4 → 64
Calls
4 calls:
Slowest
10.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
6.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
6.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
6.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))

series235.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
71.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
62.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
53.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
49.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))

simplify5.7s

Counts
44 → 76
Calls
44 calls:
Slowest
456.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
411.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
395.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
383.0ms
(- (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (+ (* 1/4 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) (pow x 2))) (* 1/2 (/ (exp (* 1/3 (- (log -2/3) (* 3 (log (/ -1 x)))))) x))))
378.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))

prune671.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.3b

regimes114.0ms

Accuracy

96.9% (0.5b remaining)

Error of 0.8b against oracle of 0.3b and baseline of 16.7b

bsearch692.0ms

end0.0ms

sample12.4s

Algorithm
intervals