Average Error: 0.0 → 0.2
Time: 16.1s
Precision: 64
Internal Precision: 128
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\sqrt{\frac{1}{x}}\right) + \left(\log_* (1 + \sqrt{1 - x \cdot x}) + \log \left(\sqrt{\frac{1}{x}}\right)\right)\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
  2. Initial simplification0.0

    \[\leadsto \log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
  3. Using strategy rm
  4. Applied div-inv0.0

    \[\leadsto \log \left(\frac{1}{x} + \color{blue}{\sqrt{1 - x \cdot x} \cdot \frac{1}{x}}\right)\]
  5. Applied distribute-rgt1-in0.0

    \[\leadsto \log \color{blue}{\left(\left(\sqrt{1 - x \cdot x} + 1\right) \cdot \frac{1}{x}\right)}\]
  6. Applied log-prod0.2

    \[\leadsto \color{blue}{\log \left(\sqrt{1 - x \cdot x} + 1\right) + \log \left(\frac{1}{x}\right)}\]
  7. Simplified0.2

    \[\leadsto \color{blue}{\log_* (1 + \sqrt{1 - x \cdot x})} + \log \left(\frac{1}{x}\right)\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt0.2

    \[\leadsto \log_* (1 + \sqrt{1 - x \cdot x}) + \log \color{blue}{\left(\sqrt{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}\right)}\]
  10. Applied log-prod0.2

    \[\leadsto \log_* (1 + \sqrt{1 - x \cdot x}) + \color{blue}{\left(\log \left(\sqrt{\frac{1}{x}}\right) + \log \left(\sqrt{\frac{1}{x}}\right)\right)}\]
  11. Applied associate-+r+0.2

    \[\leadsto \color{blue}{\left(\log_* (1 + \sqrt{1 - x \cdot x}) + \log \left(\sqrt{\frac{1}{x}}\right)\right) + \log \left(\sqrt{\frac{1}{x}}\right)}\]
  12. Final simplification0.2

    \[\leadsto \log \left(\sqrt{\frac{1}{x}}\right) + \left(\log_* (1 + \sqrt{1 - x \cdot x}) + \log \left(\sqrt{\frac{1}{x}}\right)\right)\]

Reproduce

herbie shell --seed 2018360 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)secant"
  (log (+ (/ 1 x) (/ (sqrt (- 1 (* x x))) x))))

Details

Time bar (total: 6.3s)Debug log

start275.0ms

Algorithm
intervals

setup35.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.2b

localize39.0ms

Local error

Found 2 expressions with local error:

0.2b
(log (+ (/ 1 x) (/ (sqrt (- 1 (* x x))) x)))
0.0b
(- 1 (* x x))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
2 → 35
Calls

2 calls. Slowest were:

7.0ms
(log (+ (/ 1 x) (/ (sqrt (- 1 (* x x))) x)))
1.0ms
(- 1 (* x x))

series143.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

124.0ms
(log (+ (/ 1 x) (/ (sqrt (- 1 (* x x))) x)))
18.0ms
(- 1 (* x x))

simplify1.6s

Counts
18 → 41
Calls

18 calls. Slowest were:

414.0ms
(- (log 2) (+ (* 1/4 (pow x 2)) (+ (* 3/32 (pow x 4)) (log x))))
380.0ms
(log (- (* (/ 1 x) (/ 1 x)) (* (/ (sqrt (- 1 (* x x))) x) (/ (sqrt (- 1 (* x x))) x))))
273.0ms
(- (+ (log (sqrt -1)) (/ 1 (* x (sqrt -1)))) (* 1/6 (/ 1 (* (pow x 3) (pow (sqrt -1) 3)))))

prune463.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 2 expressions with local error:

0.2b
(+ (log1p (sqrt (- 1 (* x x)))) (log (/ 1 x)))
0.0b
(- 1 (* x x))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
2 → 39
Calls

2 calls. Slowest were:

11.0ms
(+ (log1p (sqrt (- 1 (* x x)))) (log (/ 1 x)))
1.0ms
(- 1 (* x x))

series149.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

129.0ms
(+ (log1p (sqrt (- 1 (* x x)))) (log (/ 1 x)))
20.0ms
(- 1 (* x x))

simplify1.1s

Counts
19 → 45
Calls

19 calls. Slowest were:

400.0ms
(- (log 2) (+ (* 1/4 (pow x 2)) (+ (* 3/32 (pow x 4)) (log x))))
238.0ms
(- (+ (* 1/6 (/ 1 (* (pow x 3) (pow (sqrt -1) 3)))) (+ (log (sqrt -1)) (log -1))) (/ 1 (* x (sqrt -1))))
230.0ms
(- (+ (log (sqrt -1)) (/ 1 (* x (sqrt -1)))) (* 1/6 (/ 1 (* (pow x 3) (pow (sqrt -1) 3)))))

prune438.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize19.0ms

Local error

Found 4 expressions with local error:

0.2b
(+ (+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x)))) (log (sqrt (/ 1 x))))
0.1b
(sqrt (/ 1 x))
0.1b
(sqrt (/ 1 x))
0.1b
(+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x))))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 95
Calls

4 calls. Slowest were:

27.0ms
(+ (+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x)))) (log (sqrt (/ 1 x))))
4.0ms
(+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x))))
1.0ms
(sqrt (/ 1 x))

series206.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

100.0ms
(+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x))))
85.0ms
(+ (+ (log1p (sqrt (- 1 (* x x)))) (log (sqrt (/ 1 x)))) (log (sqrt (/ 1 x))))
10.0ms
(sqrt (/ 1 x))
10.0ms
(sqrt (/ 1 x))

simplify428.0ms

Counts
59 → 107
Calls

59 calls. Slowest were:

66.0ms
(* (* (+ 1 (sqrt (- 1 (* x x)))) (sqrt (/ 1 x))) (sqrt (/ 1 x)))
38.0ms
(* (* (exp (log1p (sqrt (- 1 (* x x))))) (sqrt (/ 1 x))) (sqrt (/ 1 x)))
37.0ms
(* (+ 1 (sqrt (- 1 (* x x)))) (sqrt (/ 1 x)))

prune1.2s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes114.0ms

Accuracy

0% (0.2b remaining)

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

bsearch1.0ms