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

Derivation

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

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

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

      \[\leadsto \frac{\left(\frac{2}{3} \cdot {x}^{3} + 2\right) - \color{blue}{1 \cdot {x}^{2}}}{2}\]
    5. Applied *-un-lft-identity1.3

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right)} - 1 \cdot {x}^{2}}{2}\]
    6. Applied prod-diff1.3

      \[\leadsto \frac{\color{blue}{(1 \cdot \left(\frac{2}{3} \cdot {x}^{3} + 2\right) + \left(-{x}^{2} \cdot 1\right))_* + (\left(-{x}^{2}\right) \cdot 1 + \left({x}^{2} \cdot 1\right))_*}}{2}\]
    7. Simplified1.3

      \[\leadsto \frac{\color{blue}{(\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_*} + (\left(-{x}^{2}\right) \cdot 1 + \left({x}^{2} \cdot 1\right))_*}{2}\]
    8. Simplified1.3

      \[\leadsto \frac{(\left(x \cdot x\right) \cdot \left((\frac{2}{3} \cdot x + -1)_*\right) + 2)_* + \color{blue}{0}}{2}\]

    if 415.8757977460435 < 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-sqr-sqrt0.1

      \[\leadsto \frac{\color{blue}{\sqrt{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x}} \cdot \sqrt{\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}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

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

Reproduce

herbie shell --seed 2018365 +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

start874.0ms

Algorithm
intervals

setup177.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.1b

localize53.0ms

Local error

Found 4 expressions with local error:

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

rewrite43.0ms

Algorithm
rewrite-expression-head
Counts
4 → 169
Calls

4 calls. Slowest were:

15.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
11.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))
8.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))

series230.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

141.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
37.0ms
(* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x))))
30.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
22.0ms
(* (- 1 eps) x)

simplify1.1m

Counts
225 → 181
Calls

225 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))))
1.2s
(- (* (* (- (* 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)) (exp 0))))
1.2s
(exp (- (* (+ 1 eps) x)))

prune3.6s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.2b

localize16.0ms

Local error

Found 2 expressions with local error:

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
2 → 48
Calls

2 calls. Slowest were:

28.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 were:

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

simplify2.4s

Counts
43 → 54
Calls

43 calls. Slowest were:

253.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (pow x 2) 1)))
247.0ms
(fma (sqrt (+ (* 2/3 (pow x 3)) 2)) (sqrt (+ (* 2/3 (pow x 3)) 2)) (- (* (pow x 2) 1)))
219.0ms
(fma 1 (+ (* 2/3 (pow x 3)) 2) (- (* (sqrt (pow x 2)) (sqrt (pow x 2)))))

prune715.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.2b

localize31.0ms

Local error

Found 2 expressions with local error:

0.1b
(fma 2/3 x -1)
0.0b
(fma (* x x) (fma 2/3 x -1) 2)

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

0.0ms
(fma 2/3 x -1)
0.0ms
(fma (* x x) (fma 2/3 x -1) 2)

series53.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

29.0ms
(fma 2/3 x -1)
24.0ms
(fma (* x x) (fma 2/3 x -1) 2)

simplify322.0ms

Counts
6 → 26
Calls

6 calls. Slowest were:

105.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
92.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
89.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune342.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.2b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite58.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

17.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
15.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
12.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))

series235.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

79.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
77.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
61.0ms
(cbrt (- (+ (* 2/3 (pow x 3)) 2) (pow x 2)))
18.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify8.0s

Counts
69 → 99
Calls

69 calls. Slowest were:

526.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))))
446.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))
427.0ms
(- (+ (* 1/9 (* (pow x 3) (pow 2 1/3))) (pow 2 1/3)) (* 1/6 (* (pow x 2) (pow 2 1/3))))

prune1.5s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.2b

regimes119.0ms

Accuracy

96.1% (0.6b remaining)

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

bsearch953.0ms