Average Error: 63.0 → 0.0
Time: 12.0s
Precision: 64
Internal Precision: 128
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
\[\left(\left(1 + \log n\right) + \left(\frac{\frac{1}{2}}{n} - \frac{\frac{1}{6}}{n \cdot n}\right)\right) - 1\]

Error

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original63.0
Target0
Herbie0.0
\[\log \left(n + 1\right) - \left(\frac{1}{2 \cdot n} - \left(\frac{1}{3 \cdot \left(n \cdot n\right)} - \frac{4}{{n}^{3}}\right)\right)\]

Derivation

  1. Initial program 63.0

    \[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
  2. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{\left(\left(1 + \frac{1}{2} \cdot \frac{1}{n}\right) - \left(\frac{1}{6} \cdot \frac{1}{{n}^{2}} + \log \left(\frac{1}{n}\right)\right)\right)} - 1\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\left(\left(1 + \log n\right) + \left(\frac{\frac{1}{2}}{n} - \frac{\frac{1}{6}}{n \cdot n}\right)\right)} - 1\]
  4. Final simplification0.0

    \[\leadsto \left(\left(1 + \log n\right) + \left(\frac{\frac{1}{2}}{n} - \frac{\frac{1}{6}}{n \cdot n}\right)\right) - 1\]

Reproduce

herbie shell --seed 2019004 
(FPCore (n)
  :name "logs (example 3.8)"
  :pre (> n 6.8e+15)

  :herbie-target
  (- (log (+ n 1)) (- (/ 1 (* 2 n)) (- (/ 1 (* 3 (* n n))) (/ 4 (pow n 3)))))

  (- (- (* (+ n 1) (log (+ n 1))) (* n (log n))) 1))

Details

Time bar (total: 11.7s)Debug log

sample159.0ms

Algorithm
intervals

simplify187.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

187.0ms
(- (- (* (+ n 1) (log (+ n 1))) (* n (log n))) 1)

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 63.0b

localize27.0ms

Local error

Found 3 expressions with local error:

6.1b
(- (* (+ n 1) (log (+ n 1))) (* n (log n)))
0.2b
(* (+ n 1) (log (+ n 1)))
0.2b
(* n (log n))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
3 → 55
Calls

3 calls. Slowest were:

7.0ms
(- (* (+ n 1) (log (+ n 1))) (* n (log n)))
5.0ms
(* (+ n 1) (log (+ n 1)))
1.0ms
(* n (log n))

series381.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

231.0ms
(* n (log n))
109.0ms
(- (* (+ n 1) (log (+ n 1))) (* n (log n)))
41.0ms
(* (+ n 1) (log (+ n 1)))

simplify3.8s

Counts
36 → 64
Calls

36 calls. Slowest were:

617.0ms
(- (+ 1 (* 1/2 (/ 1 n))) (+ (* n (log (/ 1 n))) (log (/ 1 n))))
537.0ms
(- (+ (* n (log -1)) (+ 1 (+ (log -1) (* 1/2 (/ 1 n))))) (+ (* n (log (/ -1 n))) (log (/ -1 n))))
450.0ms
(- (+ 1 (* 1/2 (/ 1 n))) (+ (* 1/6 (/ 1 (pow n 2))) (log (/ 1 n))))

prune588.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize31.0ms

Local error

Found 1 expressions with local error:

0.9b
(/ 1/6 (* n n))

rewrite0.0ms

Algorithm
rewrite-expression-head
Counts
1 → 11
Calls

1 calls. Slowest were:

0.0ms
(/ 1/6 (* n n))

series11.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

10.0ms
(/ 1/6 (* n n))

simplify9.0ms

Counts
3 → 14
Calls

3 calls. Slowest were:

3.0ms
(/ 1/6 (pow n 2))
3.0ms
(/ 1/6 (pow n 2))
3.0ms
(/ 1/6 (pow n 2))

prune125.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample6.3s

Algorithm
intervals