Average Error: 29.2 → 0.0
Time: 18.2s
Precision: 64
Internal Precision: 128
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00825580838562665:\\ \;\;\;\;\frac{\left(\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \left(\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}}\right)\right) \cdot \left(\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \left(\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}}\right)\right) - 1}{\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \left(\sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}} \cdot \sqrt[3]{\frac{2}{e^{-2 \cdot x} + 1}}\right) + 1}\\ \mathbf{elif}\;x \le 0.006166302486698174:\\ \;\;\;\;\left({x}^{5} \cdot \frac{2}{15} + x\right) - {x}^{3} \cdot \frac{1}{3}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{2}{e^{-2 \cdot x} + 1} - 1\right) \cdot \left(\left(\frac{2}{e^{-2 \cdot x} + 1} - 1\right) \cdot \left(\frac{2}{e^{-2 \cdot x} + 1} - 1\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.00825580838562665

    1. Initial program 0.0

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Initial simplification0.0

      \[\leadsto \frac{2}{1 + e^{-2 \cdot x}} - 1\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.0

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

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

    if -0.00825580838562665 < x < 0.006166302486698174

    1. Initial program 58.9

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Initial simplification58.9

      \[\leadsto \frac{2}{1 + e^{-2 \cdot x}} - 1\]
    3. Taylor expanded around 0 0.0

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

    if 0.006166302486698174 < x

    1. Initial program 0.0

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Initial simplification0.0

      \[\leadsto \frac{2}{1 + e^{-2 \cdot x}} - 1\]
    3. Using strategy rm
    4. Applied add-cbrt-cube0.0

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

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

Reproduce

herbie shell --seed 2018360 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))

Details

Time bar (total: 13.8s)Debug log

start140.0ms

Algorithm
intervals

setup25.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.1b

localize27.0ms

Local error

Found 3 expressions with local error:

4.1b
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
0.0b
(/ 2 (+ 1 (exp (* -2 x))))
0.0b
(+ 1 (exp (* -2 x)))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 37
Calls

3 calls. Slowest were:

8.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
2.0ms
(+ 1 (exp (* -2 x)))
1.0ms
(/ 2 (+ 1 (exp (* -2 x))))

series75.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

51.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
16.0ms
(/ 2 (+ 1 (exp (* -2 x))))
8.0ms
(+ 1 (exp (* -2 x)))

simplify341.0ms

Counts
15 → 46
Calls

15 calls. Slowest were:

94.0ms
(- (+ (* 2 (pow x 2)) 2) (* 2 x))
65.0ms
(+ (* 1 1) (- (* (exp (* -2 x)) (exp (* -2 x))) (* 1 (exp (* -2 x)))))
52.0ms
(- (+ x 1) (* 1/3 (pow x 3)))

prune498.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize30.0ms

Local error

Found 3 expressions with local error:

14.5b
(- (+ x (* 2/15 (pow x 5))) (* 1/3 (pow x 3)))
0.2b
(* 1/3 (pow x 3))
0.1b
(* 2/15 (pow x 5))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
3 → 37
Calls

3 calls. Slowest were:

6.0ms
(- (+ x (* 2/15 (pow x 5))) (* 1/3 (pow x 3)))
1.0ms
(* 1/3 (pow x 3))
1.0ms
(* 2/15 (pow x 5))

series63.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

24.0ms
(- (+ x (* 2/15 (pow x 5))) (* 1/3 (pow x 3)))
20.0ms
(* 2/15 (pow x 5))
19.0ms
(* 1/3 (pow x 3))

simplify303.0ms

Counts
17 → 46
Calls

17 calls. Slowest were:

96.0ms
(/ (exp (+ x (* 2/15 (pow x 5)))) (exp (* 1/3 (pow x 3))))
64.0ms
(- (+ x (* 2/15 (pow x 5))) (* 1/3 (pow x 3)))
55.0ms
(- (+ x (* 2/15 (pow x 5))) (* 1/3 (pow x 3)))

prune752.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

4.1b
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
4.1b
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
4.1b
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
0.1b
(cbrt (* (* (- (/ 2 (+ 1 (exp (* -2 x)))) 1) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)))

rewrite79.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

53.0ms
(cbrt (* (* (- (/ 2 (+ 1 (exp (* -2 x)))) 1) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)))
8.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
8.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)

series221.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

65.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
59.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)
51.0ms
(cbrt (* (* (- (/ 2 (+ 1 (exp (* -2 x)))) 1) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)))
46.0ms
(- (/ 2 (+ 1 (exp (* -2 x)))) 1)

simplify6.8s

Counts
43 → 84
Calls

43 calls. Slowest were:

554.0ms
(cbrt (* (* (- (/ 2 (+ 1 (exp (* -2 x)))) 1) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) (- (* (/ 2 (+ 1 (exp (* -2 x)))) (/ 2 (+ 1 (exp (* -2 x))))) (* 1 1))))
431.0ms
(cbrt (* (* (- (pow (/ 2 (+ 1 (exp (* -2 x)))) 3) (pow 1 3)) (- (* (/ 2 (+ 1 (exp (* -2 x)))) (/ 2 (+ 1 (exp (* -2 x))))) (* 1 1))) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)))
374.0ms
(cbrt (* (* (- (* (/ 2 (+ 1 (exp (* -2 x)))) (/ 2 (+ 1 (exp (* -2 x))))) (* 1 1)) (- (/ 2 (+ 1 (exp (* -2 x)))) 1)) (- (pow (/ 2 (+ 1 (exp (* -2 x)))) 3) (pow 1 3))))

prune1.3s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 4 expressions with local error:

3.8b
(- (* (* (cbrt (/ 2 (+ 1 (exp (* -2 x))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) 1)
0.2b
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
0.2b
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
0.2b
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

23.0ms
(- (* (* (cbrt (/ 2 (+ 1 (exp (* -2 x))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) 1)
1.0ms
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
1.0ms
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))

series690.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

178.0ms
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
177.0ms
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
173.0ms
(cbrt (/ 2 (+ 1 (exp (* -2 x)))))
163.0ms
(- (* (* (cbrt (/ 2 (+ 1 (exp (* -2 x))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) (cbrt (/ 2 (+ 1 (exp (* -2 x)))))) 1)

simplify797.0ms

Counts
33 → 68
Calls

33 calls. Slowest were:

145.0ms
(- (+ (* (pow 1/2 1/3) (cbrt 2)) (* 1/3 (* (* x (cbrt 2)) (pow 1/2 1/3)))) (* 1/9 (* (* (pow x 2) (cbrt 2)) (pow 1/2 1/3))))
129.0ms
(- (+ (* (pow 1/2 1/3) (cbrt 2)) (* 1/3 (* (* x (cbrt 2)) (pow 1/2 1/3)))) (* 1/9 (* (* (pow x 2) (cbrt 2)) (pow 1/2 1/3))))
128.0ms
(- (+ (* (pow 1/2 1/3) (cbrt 2)) (* 1/3 (* (* x (cbrt 2)) (pow 1/2 1/3)))) (* 1/9 (* (* (pow x 2) (cbrt 2)) (pow 1/2 1/3))))

prune875.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes564.0ms

Accuracy

100% (0.0b remaining)

Error of 0.0b against oracle of 0.0b and baseline of 31.3b

bsearch139.0ms