Average Error: 58.6 → 0.2
Time: 18.0s
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.6

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

    \[\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 2019022 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))

Details

Time bar (total: 17.3s)Debug log

sample217.0ms

Algorithm
intervals
Results
113.0ms115×body1280valid
47.0ms83×body640valid
24.0ms246×body80nan
14.0ms37×body320valid
4.0ms16×body160valid
1.0msbody80valid

simplify83.0ms

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

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 59.0b

localize18.0ms

Local error

Found 2 expressions with local error:

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

rewrite10.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
6.0ms
(/ (+ x 1) (- 1 x))
3.0ms
(log (/ (+ x 1) (- 1 x)))

series91.0ms

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

simplify1.2s

Counts
53 → 63
Calls
53 calls:
Slowest
249.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- 1 x) (- 1 x)) (- 1 x)))
136.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
102.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
89.0ms
(log (/ (* (cbrt (+ x 1)) (cbrt (+ x 1))) (* (cbrt (- 1 x)) (cbrt (- 1 x)))))
60.0ms
(+ (* 2 (/ 1 x)) (+ (* 2/3 (/ 1 (pow x 3))) (log -1)))

prune472.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize38.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)))

rewrite11.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
6.0ms
(* 2/3 (pow x 3))
3.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
1.0ms
(* 2/5 (pow x 5))

series104.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
70.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
19.0ms
(* 2/5 (pow x 5))
15.0ms
(* 2/3 (pow x 3))

simplify148.0ms

Counts
17 → 44
Calls
17 calls:
Slowest
29.0ms
(* (exp (* 2/3 (pow x 3))) (exp (* 2/5 (pow x 5))))
23.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
22.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
22.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
10.0ms
(* 2/3 (pow x 3))

prune489.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 4 expressions with local error:

6.4b
(log (+ x 1))
6.2b
(log (/ 1 (- 1 x)))
0.0b
(+ (log (+ x 1)) (log (/ 1 (- 1 x))))
0.0b
(/ 1 (- 1 x))

rewrite8.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))

series190.0ms

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

simplify1.7s

Counts
54 → 93
Calls
54 calls:
Slowest
289.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
272.0ms
(+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (+ (log -1) (/ 1 x))))
137.0ms
(+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x)))
114.0ms
(- (/ 1 x) (+ (log (/ 1 x)) (* 1/2 (/ 1 (pow x 2)))))
90.0ms
(+ x (+ (* 1/3 (pow x 3)) (* 1/2 (pow x 2))))

prune470.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

6.4b
(log (sqrt (/ (+ x 1) (- 1 x))))
6.4b
(log (sqrt (/ (+ x 1) (- 1 x))))
0.0b
(/ (+ x 1) (- 1 x))
0.0b
(/ (+ x 1) (- 1 x))

rewrite12.0ms

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

series200.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
92.0ms
(log (sqrt (/ (+ x 1) (- 1 x))))
82.0ms
(log (sqrt (/ (+ x 1) (- 1 x))))
15.0ms
(/ (+ x 1) (- 1 x))
10.0ms
(/ (+ x 1) (- 1 x))

simplify3.6s

Counts
110 → 132
Calls
110 calls:
Slowest
406.0ms
(- (log (sqrt -1)) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 2))) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 4))) (/ 1 (* x (pow (sqrt -1) 2))))))
373.0ms
(- (log (sqrt -1)) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 2))) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 4))) (/ 1 (* x (pow (sqrt -1) 2))))))
367.0ms
(- (log (sqrt -1)) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 2))) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 4))) (/ 1 (* x (pow (sqrt -1) 2))))))
319.0ms
(- (log (sqrt -1)) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 2))) (+ (/ 1 (* (pow x 2) (pow (sqrt -1) 4))) (/ 1 (* x (pow (sqrt -1) 2))))))
306.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- 1 x) (- 1 x)) (- 1 x)))

prune731.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes30.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample7.5s

Algorithm
intervals
Results
4.0s3409×body1280valid
1.5s2484×body640valid
1.1s7987×body80nan
490.0ms1300×body320valid
169.0ms604×body160valid
26.0ms203×body80valid