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

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

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

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

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

    if 354.06473683693855 < 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. Taylor expanded around -inf 0.1

      \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \color{blue}{e^{x \cdot \varepsilon - 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 354.06473683693855:\\ \;\;\;\;\frac{\sqrt[3]{\left(\left(\left(2 + \sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \left(\sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}\right)\right) - {x}^{2}\right) \cdot \left(\left(2 + \sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \left(\sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}\right)\right) - {x}^{2}\right)\right) \cdot \left(\left(2 + \sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \left(\sqrt[3]{\frac{2}{3} \cdot {x}^{3}} \cdot \sqrt[3]{\frac{2}{3} \cdot {x}^{3}}\right)\right) - {x}^{2}\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \varepsilon - x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{\left(\varepsilon + 1\right) \cdot \left(-x\right)}}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019016 
(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

sample432.0ms

Algorithm
intervals
Results
541×(pre true 80)
336×(body real 80)
77×(body exit 10240)
63×(body real 1280)
38×(body real 640)
16×(body real 320)
11×(body real 160)

simplify572.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
572.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.8b

localize74.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
(exp (- (* (- 1 eps) x)))
0.0b
(exp (- (* (+ 1 eps) x)))
0.0b
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))

rewrite50.0ms

Algorithm
rewrite-expression-head
Rules
81×frac-sub
78×exp-neg
76×frac-times
59×exp-diff
59×neg-sub0
38×associate-*r/
38×associate-*l/
30×flip-+
30×flip3-+
28×flip--
28×flip3--
19×un-div-inv
12×exp-prod
10×add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-cbrt-cube
pow1
add-exp-log
rem-exp-log
associate-*l*
associate-*r*
neg-log
distribute-rgt-neg-in
neg-mul-1
distribute-lft-neg-in
cbrt-unprod
*-commutative
prod-exp
pow-prod-down
diff-log
sub-neg
Counts
4 → 153
Calls
4 calls:
Slowest
27.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
7.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
6.0ms
(exp (- (* (- 1 eps) x)))
5.0ms
(exp (- (* (+ 1 eps) x)))

series199.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
123.0ms
(- (* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x)))) (* (- (/ 1 eps) 1) (exp (- (* (+ 1 eps) x)))))
30.0ms
(* (+ 1 (/ 1 eps)) (exp (- (* (- 1 eps) x))))
23.0ms
(exp (- (* (+ 1 eps) x)))
22.0ms
(exp (- (* (- 1 eps) x)))

simplify47.8s

Counts
212 → 165
Calls
212 calls:
Slowest
686.0ms
(* (* (* (+ 1 (/ 1 eps)) (+ 1 (/ 1 eps))) (+ 1 (/ 1 eps))) (* (* (exp (- (* (- 1 eps) x))) (exp (- (* (- 1 eps) x)))) (exp (- (* (- 1 eps) x)))))
628.0ms
(- (* (+ 1 (/ 1 eps)) (+ (/ 1 eps) 1)) (* (exp (* (- 1 eps) x)) (* (- (* (/ 1 eps) (/ 1 eps)) (* 1 1)) (exp (- (* (+ 1 eps) x))))))
616.0ms
(* (- 1 (/ 1 eps)) (+ (* (/ 1 eps) (/ 1 eps)) (+ (* 1 1) (* (/ 1 eps) 1))))
614.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))))
609.0ms
(sqrt (exp (- (* (- 1 eps) x))))

prune2.5s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 1.0b

localize34.0ms

Local error

Found 2 expressions with local error:

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

rewrite28.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
25.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
2.0ms
(* 2/3 (pow x 3))

series57.0ms

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

simplify469.0ms

Counts
17 → 35
Calls
17 calls:
Slowest
84.0ms
(/ (exp (+ (* 2/3 (pow x 3)) 2)) (exp (pow x 2)))
77.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
57.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
57.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
57.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune344.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 1.0b

localize17.0ms

Local error

Found 4 expressions with local error:

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

rewrite68.0ms

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

series258.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
76.0ms
(cbrt (* 2/3 (pow x 3)))
69.0ms
(cbrt (* 2/3 (pow x 3)))
57.0ms
(- (+ (* (* (cbrt (* 2/3 (pow x 3))) (cbrt (* 2/3 (pow x 3)))) (cbrt (* 2/3 (pow x 3)))) 2) (pow x 2))
55.0ms
(cbrt (* 2/3 (pow x 3)))

simplify583.0ms

Counts
22 → 55
Calls
22 calls:
Slowest
85.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
79.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))
78.0ms
(/ (exp (+ (* (* (cbrt (* 2/3 (pow x 3))) (cbrt (* 2/3 (pow x 3)))) (cbrt (* 2/3 (pow x 3)))) 2)) (exp (pow x 2)))
71.0ms
(- (+ (* (* (cbrt (* 2/3 (pow x 3))) (cbrt (* 2/3 (pow x 3)))) (cbrt (* 2/3 (pow x 3)))) 2) (pow x 2))
52.0ms
(- (+ (* 2/3 (pow x 3)) 2) (pow x 2))

prune639.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 1.0b

localize37.0ms

Local error

Found 4 expressions with local error:

40.1b
(cbrt (* 2/3 (pow x 3)))
40.1b
(cbrt (* 2/3 (pow x 3)))
40.1b
(cbrt (* 2/3 (pow x 3)))
40.1b
(cbrt (* 2/3 (pow x 3)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
add-exp-log
pow1/3
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
cbrt-prod
Counts
4 → 36
Calls
4 calls:
Slowest
2.0ms
(cbrt (* 2/3 (pow x 3)))
2.0ms
(cbrt (* 2/3 (pow x 3)))
2.0ms
(cbrt (* 2/3 (pow x 3)))
2.0ms
(cbrt (* 2/3 (pow x 3)))

series318.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
96.0ms
(cbrt (* 2/3 (pow x 3)))
90.0ms
(cbrt (* 2/3 (pow x 3)))
75.0ms
(cbrt (* 2/3 (pow x 3)))
56.0ms
(cbrt (* 2/3 (pow x 3)))

simplify72.0ms

Counts
16 → 48
Calls
16 calls:
Slowest
17.0ms
(* -1 (* x (cbrt -2/3)))
10.0ms
(* -1 (* x (cbrt -2/3)))
10.0ms
(* -1 (* x (cbrt -2/3)))
9.0ms
(* -1 (* x (cbrt -2/3)))
2.0ms
(* x (cbrt 2/3))

prune729.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 1.0b

regimes146.0ms

Accuracy

96.3% (0.6b remaining)

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

bsearch470.0ms

end0.0ms

sample12.4s

Algorithm
intervals
Results
15985×(pre true 80)
10126×(body real 80)
1949×(body exit 10240)
1693×(body real 1280)
1274×(body real 640)
643×(body real 320)
300×(body real 160)