Average Error: 58.7 → 0.2
Time: 16.5s
Precision: 64
Internal Precision: 128
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\left(x \cdot 2 + \left(\frac{2}{5} \cdot {x}^{5} + {x}^{3} \cdot \frac{2}{3}\right)\right) \cdot \frac{1}{2}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.7

    \[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
  2. Simplified58.7

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \log \left(\frac{x + 1}{1 - x}\right)}\]
  3. Taylor expanded around 0 0.2

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(2 \cdot x + \left(\frac{2}{3} \cdot {x}^{3} + \frac{2}{5} \cdot {x}^{5}\right)\right)}\]
  4. Final simplification0.2

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

Reproduce

herbie shell --seed 2019010 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))

Details

Time bar (total: 16.1s)Debug log

sample326.0ms

Algorithm
intervals

simplify72.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
72.0ms
(* (/ 1 2) (log (/ (+ 1 x) (- 1 x))))

prune20.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 58.5b

localize26.0ms

Local error

Found 2 expressions with local error:

5.5b
(log (/ (+ x 1) (- 1 x)))
0.0b
(/ (+ x 1) (- 1 x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
18×times-frac
17×add-cube-cbrt
17×*-un-lft-identity
17×add-sqr-sqrt
15×log-prod
add-exp-log
associate-/r/
add-cbrt-cube
associate-/l*
associate-/r*
pow1
associate-/l/
add-log-exp
flip--
div-inv
rem-log-exp
div-exp
flip3--
flip-+
log-pow
flip3-+
frac-2neg
clear-num
log-div
cbrt-undiv
Counts
2 → 57
Calls
2 calls:
Slowest
3.0ms
(/ (+ x 1) (- 1 x))
1.0ms
(log (/ (+ x 1) (- 1 x)))

series85.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
64.0ms
(log (/ (+ x 1) (- 1 x)))
20.0ms
(/ (+ x 1) (- 1 x))

simplify1.2s

Counts
53 → 63
Calls
53 calls:
Slowest
293.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- 1 x) (- 1 x)) (- 1 x)))
143.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
134.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
60.0ms
(+ (* 2 (/ 1 x)) (+ (* 2/3 (/ 1 (pow x 3))) (log -1)))
53.0ms
(log (/ (* (cbrt (+ x 1)) (cbrt (+ x 1))) (* (cbrt (- 1 x)) (cbrt (- 1 x)))))

prune468.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize31.0ms

Local error

Found 3 expressions with local error:

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

rewrite6.0ms

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

series110.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
65.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
29.0ms
(* 2/5 (pow x 5))
16.0ms
(* 2/3 (pow x 3))

simplify136.0ms

Counts
17 → 44
Calls
17 calls:
Slowest
34.0ms
(* (exp (* 2/3 (pow x 3))) (exp (* 2/5 (pow x 5))))
20.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
12.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
12.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
10.0ms
(* 2/3 (pow x 3))

prune411.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

5.5b
(log (+ x 1))
5.5b
(log (/ 1 (- 1 x)))
0.0b
(/ 1 (- 1 x))
0.0b
(+ (log (+ x 1)) (log (/ 1 (- 1 x))))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
18×log-prod
13×*-un-lft-identity
12×pow1
add-cube-cbrt
add-sqr-sqrt
log-pow
add-exp-log
associate-/r/
associate-+r+
log-div
add-log-exp
distribute-lft-out
add-cbrt-cube
flip--
div-inv
flip-+
log-rec
rem-log-exp
flip3--
flip3-+
associate-/r*
associate-+l+
inv-pow
pow-flip
associate-+l-
rec-exp
unsub-neg
frac-2neg
sum-log
associate-+r-
clear-num
+-commutative
Counts
4 → 81
Calls
4 calls:
Slowest
5.0ms
(+ (log (+ x 1)) (log (/ 1 (- 1 x))))
1.0ms
(log (/ 1 (- 1 x)))
1.0ms
(log (+ x 1))
1.0ms
(/ 1 (- 1 x))

series158.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
103.0ms
(+ (log (+ x 1)) (log (/ 1 (- 1 x))))
26.0ms
(log (/ 1 (- 1 x)))
23.0ms
(log (+ x 1))
7.0ms
(/ 1 (- 1 x))

simplify1.5s

Counts
54 → 93
Calls
54 calls:
Slowest
282.0ms
(+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (+ (log -1) (/ 1 x))))
243.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
118.0ms
(- (/ 1 x) (+ (log (/ 1 x)) (* 1/2 (/ 1 (pow x 2)))))
109.0ms
(+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x)))
81.0ms
(- (+ (/ 1 (pow x 3)) (+ (/ 1 (pow x 2)) (/ 1 x))))

prune349.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

5.5b
(log (+ x 1))
5.5b
(log (+ x 1))
5.5b
(log (+ x 1))
5.5b
(log (/ 1 (- 1 x)))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
15×log-prod
add-exp-log
pow1
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
log-div
log-pow
rem-log-exp
add-log-exp
add-cbrt-cube
flip-+
flip3-+
associate-/r/
inv-pow
flip--
pow-flip
div-inv
log-rec
flip3--
rec-exp
Counts
4 → 62
Calls
4 calls:
Slowest
1.0ms
(log (/ 1 (- 1 x)))
1.0ms
(log (+ x 1))
1.0ms
(log (+ x 1))
1.0ms
(log (+ x 1))

series140.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
40.0ms
(log (+ x 1))
39.0ms
(log (+ x 1))
33.0ms
(log (+ x 1))
28.0ms
(log (/ 1 (- 1 x)))

simplify2.3s

Counts
41 → 74
Calls
41 calls:
Slowest
294.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
264.0ms
(+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (+ (log -1) (/ 1 x))))
260.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
249.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
172.0ms
(- (/ 1 x) (+ (log (/ 1 x)) (* 1/2 (/ 1 (pow x 2)))))

prune467.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

regimes44.0ms

Accuracy

0% (0.2b remaining)

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

bsearch4.0ms

end0.0ms

sample8.2s

Algorithm
intervals