Average Error: 29.6 → 1.1
Time: 1.6m
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 743.0021431928681:\\ \;\;\;\;\frac{\frac{e^{\log \left(\left(2 + \frac{2}{3} \cdot {x}^{3}\right) \cdot \left(2 + \frac{2}{3} \cdot {x}^{3}\right) - {x}^{2} \cdot {x}^{2}\right)}}{e^{\left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \frac{1}{3}\right) + \log 2}}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(e^{x \cdot \varepsilon - x} + \frac{e^{x \cdot \varepsilon - x}}{\varepsilon}\right) - e^{\left(1 + \varepsilon\right) \cdot \left(-x\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 < 743.0021431928681

    1. Initial program 39.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. Taylor expanded around 0 1.5

      \[\leadsto \frac{\color{blue}{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2}}}{2}\]
    3. Using strategy rm
    4. Applied add-exp-log1.5

      \[\leadsto \frac{\color{blue}{e^{\log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2}\right)}}}{2}\]
    5. Using strategy rm
    6. Applied flip--1.5

      \[\leadsto \frac{e^{\log \color{blue}{\left(\frac{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2} \cdot {x}^{2}}{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) + {x}^{2}}\right)}}}{2}\]
    7. Applied log-div1.5

      \[\leadsto \frac{e^{\color{blue}{\log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2} \cdot {x}^{2}\right) - \log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) + {x}^{2}\right)}}}{2}\]
    8. Applied exp-diff1.5

      \[\leadsto \frac{\color{blue}{\frac{e^{\log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2} \cdot {x}^{2}\right)}}{e^{\log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) + {x}^{2}\right)}}}}{2}\]
    9. Taylor expanded around 0 1.5

      \[\leadsto \frac{\frac{e^{\log \left(\left(\frac{2}{3} \cdot {x}^{3} + 2\right) \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) - {x}^{2} \cdot {x}^{2}\right)}}{e^{\color{blue}{\log 2 + \left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{2} \cdot {x}^{2}\right)}}}}{2}\]
    10. Simplified1.5

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

    if 743.0021431928681 < x

    1. Initial program 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 -inf 0

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

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

Reproduce

herbie shell --seed 2019005 
(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.6m)Debug log

sample444.0ms

Algorithm
intervals

simplify130.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

130.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: 32.7b

localize75.0ms

Local error

Found 4 expressions with local error:

3.9b
(- (* (+ 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) 1) (exp (- (* (+ 1 eps) x))))

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 159
Calls

4 calls. Slowest were:

20.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
11.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))
7.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))

series153.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

98.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
22.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))
19.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
14.0ms
(* (- 1 eps) x)

simplify48.6s

Counts
222 → 171
Calls

222 calls. Slowest were:

718.0ms
(* (* (* (+ 1 (/ 1 eps)) (+ 1 (/ 1 eps))) (+ 1 (/ 1 eps))) (* (* (exp (- (* (- 1 eps) x))) (exp (- (* (- 1 eps) x)))) (exp (- (* (- 1 eps) x)))))
646.0ms
(- (* (* (+ (pow 1 3) (pow (/ 1 eps) 3)) (exp (- (* (- 1 eps) x)))) (+ (* (/ 1 eps) (/ 1 eps)) (+ (* 1 1) (* (/ 1 eps) 1)))) (* (+ (* 1 1) (- (* (/ 1 eps) (/ 1 eps)) (* 1 (/ 1 eps)))) (* (- (pow (/ 1 eps) 3) (pow 1 3)) (exp (- (* (+ 1 eps) x))))))
584.0ms
(cbrt (exp (- (* (+ 1 eps) x))))

prune2.9s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.5b

localize16.0ms

Local error

Found 2 expressions with local error:

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

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
2 → 29
Calls

2 calls. Slowest were:

27.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
2.0ms
(* 2/3 (pow x 3))

series36.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

20.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
16.0ms
(* 2/3 (pow x 3))

simplify407.0ms

Counts
17 → 35
Calls

17 calls. Slowest were:

85.0ms
(/ (exp (+ (* 2/3 (pow x 3)) 2)) (exp (pow x 2)))
65.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
61.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune431.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.5b

localize19.0ms

Local error

Found 4 expressions with local error:

9.4b
(log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
6.6b
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
0.4b
(exp (log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2))))
0.1b
(* 2/3 (pow x 3))

rewrite67.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

25.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
23.0ms
(log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
16.0ms
(exp (log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2))))

series136.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
29.0ms
(exp (log (- (+ (* 2/3 (pow x 3)) 2) (pow x 2))))
28.0ms
(* 2/3 (pow x 3))
27.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify2.4s

Counts
45 → 78
Calls

45 calls. Slowest were:

244.0ms
(- (log 2/3) (+ (* 3 (log (/ 1 x))) (+ (* 9/8 (/ 1 (pow x 2))) (* 3/2 (/ 1 x)))))
209.0ms
(log (- (pow (+ (* 2/3 (pow x 3)) 2) 3) (pow (pow x 2) 3)))
184.0ms
(log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))

prune996.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

localize49.0ms

Local error

Found 4 expressions with local error:

12.1b
(log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))
10.4b
(/ (exp (log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))) (exp (log (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2)))))
9.5b
(log (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
8.6b
(- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2)))

rewrite102.0ms

Algorithm
rewrite-expression-head
Counts
4 → 128
Calls

4 calls. Slowest were:

62.0ms
(/ (exp (log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))) (exp (log (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2)))))
19.0ms
(log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))
12.0ms
(- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2)))

series233.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

93.0ms
(log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))
60.0ms
(/ (exp (log (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2))))) (exp (log (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2)))))
52.0ms
(log (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
28.0ms
(- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2)))

simplify24.5s

Counts
156 → 140
Calls

156 calls. Slowest were:

558.0ms
(/ (exp (log (sqrt (- (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (* (pow x 2) (pow x 2)))))) (exp (log (cbrt (+ (+ (* 2/3 (pow x 3)) 2) (pow x 2))))))
333.0ms
(- (+ (* 6 (/ 1 (pow x 3))) (log 4/9)) (+ (* 6 (log (/ 1 x))) (* 9/4 (/ 1 (pow x 2)))))
322.0ms
(exp (log (+ (* (+ (* 2/3 (pow x 3)) 2) (+ (* 2/3 (pow x 3)) 2)) (- (* (pow x 2) (pow x 2)) (* (+ (* 2/3 (pow x 3)) 2) (pow x 2))))))

prune2.2s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

regimes74.0ms

Accuracy

95% (0.7b remaining)

Error of 1.1b against oracle of 0.4b and baseline of 14.1b

bsearch496.0ms

end0.0ms

sample12.9s

Algorithm
intervals