Average Error: 58.3 → 0.3
Time: 15.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.3

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

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

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

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

Details

Time bar (total: 15.0s)Debug log

sample277.0ms

Algorithm
intervals
Results
524×(pre true 80)
268×(body nan 80)
105×(body real 1280)
82×(body real 640)
41×(body real 320)
17×(body real 160)
11×(body real 80)

simplify73.0ms

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 58.2b

localize20.0ms

Local error

Found 2 expressions with local error:

6.1b
(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)))

series111.0ms

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

simplify1.5s

Counts
53 → 63
Calls
53 calls:
Slowest
331.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- 1 x) (- 1 x)) (- 1 x)))
167.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
157.0ms
(- (+ (* 2 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))
98.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)))

prune599.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

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

series123.0ms

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

simplify100.0ms

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

prune492.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize26.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

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

series191.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
91.0ms
(+ (* 2/3 (pow x 3)) (log (exp (* 2/5 (pow x 5)))))
38.0ms
(* 2/5 (pow x 5))
35.0ms
(log (exp (* 2/5 (pow x 5))))
27.0ms
(* 2/3 (pow x 3))

simplify221.0ms

Counts
27 → 63
Calls
27 calls:
Slowest
34.0ms
(* (exp (* 2/3 (pow x 3))) (exp (* 2/5 (pow x 5))))
24.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
24.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
24.0ms
(+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))
13.0ms
(log (exp (* 2/5 (pow x 5))))

prune865.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize45.0ms

Local error

Found 4 expressions with local error:

6.3b
(log (sqrt (+ 1 x)))
6.1b
(log (/ (sqrt (+ x 1)) (- 1 x)))
0.0b
(/ (sqrt (+ x 1)) (- 1 x))
0.0b
(+ (log (sqrt (+ 1 x))) (log (/ (sqrt (+ x 1)) (- 1 x))))

rewrite25.0ms

Algorithm
rewrite-expression-head
Rules
60×log-prod
54×times-frac
53×*-un-lft-identity
49×add-cube-cbrt
49×add-sqr-sqrt
36×sqrt-prod
24×associate-+r+
10×add-exp-log
10×pow1
log-pow
associate-/l*
associate-/r/
sqrt-div
add-cbrt-cube
associate-+l+
log-div
add-log-exp
distribute-lft-out
flip-+
flip3-+
flip--
div-inv
rem-log-exp
flip3--
associate-/r*
associate-/l/
associate-+l-
div-exp
pow1/2
frac-2neg
sum-log
associate-+r-
clear-num
+-commutative
cbrt-undiv
Counts
4 → 144
Calls
4 calls:
Slowest
9.0ms
(+ (log (sqrt (+ 1 x))) (log (/ (sqrt (+ x 1)) (- 1 x))))
7.0ms
(/ (sqrt (+ x 1)) (- 1 x))
4.0ms
(log (/ (sqrt (+ x 1)) (- 1 x)))
2.0ms
(log (sqrt (+ 1 x)))

series266.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
146.0ms
(+ (log (sqrt (+ 1 x))) (log (/ (sqrt (+ x 1)) (- 1 x))))
63.0ms
(log (/ (sqrt (+ x 1)) (- 1 x)))
35.0ms
(log (sqrt (+ 1 x)))
22.0ms
(/ (sqrt (+ x 1)) (- 1 x))

simplify2.0s

Counts
136 → 156
Calls
136 calls:
Slowest
162.0ms
(- (+ (* 1/2 x) (* 1/6 (pow x 3))) (* 1/4 (pow x 2)))
161.0ms
(/ (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))) (* (* (- 1 x) (- 1 x)) (- 1 x)))
133.0ms
(+ (* 3/2 x) (+ (* 1/2 (pow x 3)) (* 1/4 (pow x 2))))
74.0ms
(log (/ (* (cbrt (sqrt (+ x 1))) (cbrt (sqrt (+ x 1)))) (* (cbrt (- 1 x)) (cbrt (- 1 x)))))
58.0ms
(log (/ (* (cbrt (sqrt (+ x 1))) (cbrt (sqrt (+ x 1)))) 1))

prune943.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

regimes31.0ms

Accuracy

0% (0.2b remaining)

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

bsearch4.0ms

end0.0ms

sample7.0s

Algorithm
intervals
Results
15997×(pre true 80)
7996×(body nan 80)
3363×(body real 1280)
2518×(body real 640)
1257×(body real 320)
636×(body real 160)
227×(body real 80)