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

    1. Initial program 39.7

      \[\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.3

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

      \[\leadsto \frac{\left(\frac{2}{3} \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} + 2\right) - {x}^{2}}{2}\]
    5. Applied associate-*r*1.3

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

    if 70.21344082412496 < x

    1. Initial program 0.2

      \[\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-sqr-sqrt0.2

      \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \color{blue}{\left(\sqrt{e^{-\left(1 - \varepsilon\right) \cdot x}} \cdot \sqrt{e^{-\left(1 - \varepsilon\right) \cdot 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.0

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

Reproduce

herbie shell --seed 2019004 +o rules:numerics
(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.4m)Debug log

sample445.0ms

Algorithm
intervals

simplify150.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

149.0ms
(/ (- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))) 2)

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.8b

localize36.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 154
Calls

4 calls. Slowest were:

13.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
7.0ms
(- (/ 1 eps) 1)
3.0ms
(exp (- (* (- 1 eps) x)))

series166.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

102.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
28.0ms
(exp (- (* (+ 1 eps) x)))
22.0ms
(exp (- (* (- 1 eps) x)))
15.0ms
(- (/ 1 eps) 1)

simplify50.8s

Counts
198 → 166
Calls

198 calls. Slowest were:

1.2s
(- (* (* (+ (pow 1 3) (pow (/ 1 eps) 3)) (exp 0)) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (+ (* 1 1) (- (* (/ 1 eps) (/ 1 eps)) (* 1 (/ 1 eps)))) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) (exp 0))))
938.0ms
(- (* (* (- (* 1 1) (* (/ 1 eps) (/ 1 eps))) 1) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (- 1 (/ 1 eps)) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) (exp 0))))
881.0ms
(- (* (* (- (* 1 1) (* (/ 1 eps) (/ 1 eps))) (exp 0)) (* (+ (/ 1 eps) 1) (exp (* (+ 1 eps) x)))) (* (* (- 1 (/ 1 eps)) (exp (* (- 1 eps) x))) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) 1)))

prune2.6s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.5b

localize16.0ms

Local error

Found 2 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
2 → 48
Calls

2 calls. Slowest were:

17.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
1.0ms
(* 2/3 (pow x 3))

series31.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify2.3s

Counts
43 → 54
Calls

43 calls. Slowest were:

227.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))
201.0ms
(fma (sqrt (+ (* 2/3 (pow x 3)) 2)) (sqrt (+ (* 2/3 (pow x 3)) 2)) (- (* (pow x 2) 1)))
168.0ms
(fma (sqrt (+ (* 2/3 (pow x 3)) 2)) (sqrt (+ (* 2/3 (pow x 3)) 2)) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))

prune628.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.5b

localize15.0ms

Local error

Found 3 expressions with local error:

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

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
3 → 58
Calls

3 calls. Slowest were:

22.0ms
(- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2))
3.0ms
(* (* 2/3 x) (* x x))
0.0ms
(* 2/3 x)

series64.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify2.8s

Counts
45 → 67
Calls

45 calls. Slowest were:

377.0ms
(* (* (* (* 2/3 x) (* 2/3 x)) (* 2/3 x)) (* (* (* x x) (* x x)) (* x x)))
238.0ms
(fma 1 (+ (* (* 2/3 x) (* x x)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))
191.0ms
(fma 1 (+ (* (* 2/3 x) (* x x)) 2) (- (* (cbrt (pow x 2)) (* (cbrt (pow x 2)) (cbrt (pow x 2))))))

prune609.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.5b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

23.0ms
(- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2))
9.0ms
(cbrt (- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2)))
9.0ms
(cbrt (- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2)))

series249.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

85.0ms
(cbrt (- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2)))
73.0ms
(cbrt (- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2)))
66.0ms
(cbrt (- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2)))
24.0ms
(- (+ (* (* 2/3 x) (* x x)) 2) (pow x 2))

simplify8.1s

Counts
69 → 99
Calls

69 calls. Slowest were:

766.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))))
361.0ms
(cbrt (- (* (+ (* (* 2/3 x) (* x x)) 2) (+ (* (* 2/3 x) (* x x)) 2)) (* (pow x 2) (pow x 2))))
355.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))))

prune1.1s

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.5b

regimes135.0ms

Accuracy

96.7% (0.6b remaining)

Error of 1.0b against oracle of 0.4b and baseline of 17.0b

bsearch454.0ms

end0.0ms

sample12.4s

Algorithm
intervals