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

    1. Initial program 38.9

      \[\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 associate--l+1.3

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

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

    if 62.538726348649945 < 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}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

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

Reproduce

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

sample376.0ms

Algorithm
intervals
Results
129.0ms71×body10240exit
98.0ms320×body80valid
65.0ms49×body1280valid
39.0ms43×body640valid
15.0ms23×body320valid
5.0ms13×body160valid

simplify180.0ms

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

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.2b

localize49.0ms

Local error

Found 4 expressions with local error:

4.1b
(- (* (+ 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)

rewrite41.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
24.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
7.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
4.0ms
(* (+ 1 eps) x)
2.0ms
(* (- 1 eps) x)

series132.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
85.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
19.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
15.0ms
(* (- 1 eps) x)
14.0ms
(* (+ 1 eps) x)

simplify44.8s

Counts
204 → 157
Calls
204 calls:
Slowest
663.0ms
(- (+ (/ (exp (- (* x eps) x)) eps) (+ (exp (- (* x eps) x)) (exp (- (+ (* x eps) x))))) (/ (exp (- (+ (* x eps) x))) eps))
641.0ms
(* (exp (* (- 1 eps) x)) (exp (* (+ 1 eps) x)))
628.0ms
(sqrt (exp (- (* (- 1 eps) x))))
598.0ms
(* (* (* (+ 1 (/ 1 eps)) (+ 1 (/ 1 eps))) (+ 1 (/ 1 eps))) (* (* (exp (- (* (- 1 eps) x))) (exp (- (* (- 1 eps) x)))) (exp (- (* (- 1 eps) x)))))
587.0ms
(cbrt (exp (- (* (- 1 eps) x))))

prune2.3s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.6b

localize16.0ms

Local error

Found 3 expressions with local error:

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

rewrite16.0ms

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

series95.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
49.0ms
(+ (* 2/3 (pow x 3)) 2)
25.0ms
(* 2/3 (pow x 3))
21.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

simplify506.0ms

Counts
20 → 48
Calls
20 calls:
Slowest
93.0ms
(/ (exp (+ (* 2/3 (pow x 3)) 2)) (exp (pow x 2)))
73.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
65.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
65.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
47.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune515.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.6b

localize12.0ms

Local error

Found 3 expressions with local error:

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

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
associate-*r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
pow1
sub-neg
associate-+r+
flip--
flip-+
*-commutative
unpow3
flip3--
flip3-+
sum-log
associate-+r-
+-commutative
cube-mult
Counts
3 → 38
Calls
3 calls:
Slowest
3.0ms
(+ (* 2/3 (pow x 3)) (- 2 (pow x 2)))
1.0ms
(* 2/3 (pow x 3))
0.0ms
(- 2 (pow x 2))

series66.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
30.0ms
(- 2 (pow x 2))
18.0ms
(* 2/3 (pow x 3))
17.0ms
(+ (* 2/3 (pow x 3)) (- 2 (pow x 2)))

simplify373.0ms

Counts
17 → 47
Calls
17 calls:
Slowest
143.0ms
(* (exp (* 2/3 (pow x 3))) (exp (- 2 (pow x 2))))
65.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
62.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
53.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
7.0ms
(* 2/3 (pow x 3))

prune430.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.6b

localize33.0ms

Local error

Found 4 expressions with local error:

43.7b
(cbrt (pow x 3))
43.7b
(cbrt (pow x 3))
7.8b
(+ (* (* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3)))) x) (- 2 (pow x 2)))
0.1b
(* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3))))

rewrite22.0ms

Algorithm
rewrite-expression-head
Rules
10×cbrt-prod
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
pow1
rem-cbrt-cube
unpow3
pow1/3
associate-+r+
cube-mult
flip-+
*-commutative
associate-*r*
flip3-+
sub-neg
sum-log
associate-+r-
+-commutative
Counts
4 → 51
Calls
4 calls:
Slowest
15.0ms
(+ (* (* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3)))) x) (- 2 (pow x 2)))
5.0ms
(* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3))))
1.0ms
(cbrt (pow x 3))
1.0ms
(cbrt (pow x 3))

series146.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
68.0ms
(* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3))))
38.0ms
(+ (* (* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3)))) x) (- 2 (pow x 2)))
20.0ms
(cbrt (pow x 3))
19.0ms
(cbrt (pow x 3))

simplify687.0ms

Counts
27 → 63
Calls
27 calls:
Slowest
304.0ms
(- (+ (* 2/3 (* (pow x 3) (pow (cbrt -1) 2))) 2) (pow x 2))
111.0ms
(* (exp (* (* 2/3 (* (cbrt (pow x 3)) (cbrt (pow x 3)))) x)) (exp (- 2 (pow x 2))))
68.0ms
(* 2/3 (* (pow x 2) (pow (cbrt -1) 2)))
63.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
55.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune758.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.6b

regimes211.0ms

Accuracy

96.3% (0.6b remaining)

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

bsearch242.0ms

end0.0ms

sample11.0s

Algorithm
intervals
Results
4.2s1935×body10240exit
2.6s9925×body80valid
2.3s1705×body1280valid
1.1s1263×body640valid
395.0ms672×body320valid
117.0ms339×body160valid