Average Error: 29.6 → 0.1
Time: 14.7s
Precision: 64
Internal Precision: 128
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 14302.326937808648:\\ \;\;\;\;\log \left(1 + \frac{1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{3}}{N}}{N \cdot N} - \left(\frac{\frac{1}{2}}{N \cdot N} + \frac{-1}{N}\right)\\ \end{array}\]

Error

Bits error versus N

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if N < 14302.326937808648

    1. Initial program 0.1

      \[\log \left(N + 1\right) - \log N\]
    2. Using strategy rm
    3. Applied diff-log0.1

      \[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]
    4. Taylor expanded around 0 0.1

      \[\leadsto \log \color{blue}{\left(\frac{1}{N} + 1\right)}\]

    if 14302.326937808648 < N

    1. Initial program 59.5

      \[\log \left(N + 1\right) - \log N\]
    2. Using strategy rm
    3. Applied diff-log59.2

      \[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]
    4. Taylor expanded around -inf 0.0

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

      \[\leadsto \color{blue}{\frac{1}{N} - \frac{1}{N \cdot N} \cdot \left(\frac{1}{2} - \frac{\frac{1}{3}}{N}\right)}\]
    6. Taylor expanded around 0 0.0

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{3}}{N}}{N \cdot N} - \left(\frac{-1}{N} + \frac{\frac{1}{2}}{N \cdot N}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;N \le 14302.326937808648:\\ \;\;\;\;\log \left(1 + \frac{1}{N}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{3}}{N}}{N \cdot N} - \left(\frac{\frac{1}{2}}{N \cdot N} + \frac{-1}{N}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 
(FPCore (N)
  :name "2log (problem 3.3.6)"
  (- (log (+ N 1)) (log N)))

Details

Time bar (total: 13.9s)Debug log

sample69.0ms

Algorithm
intervals

simplify4.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

4.0ms
(- (log (+ N 1)) (log N))

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.1b

localize11.0ms

Local error

Found 2 expressions with local error:

2.7b
(- (log (+ N 1)) (log N))
2.5b
(log (+ N 1))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
2 → 34
Calls

2 calls. Slowest were:

5.0ms
(- (log (+ N 1)) (log N))
1.0ms
(log (+ N 1))

series132.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

110.0ms
(- (log (+ N 1)) (log N))
22.0ms
(log (+ N 1))

simplify998.0ms

Counts
22 → 40
Calls

22 calls. Slowest were:

227.0ms
(- (+ (/ 1 N) (log -1)) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ -1 N))))
206.0ms
(- (/ 1 N) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ 1 N))))
145.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))

prune370.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize6.0ms

Local error

Found 2 expressions with local error:

2.9b
(log (/ (+ N 1) N))
0.0b
(/ (+ N 1) N)

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
2 → 29
Calls

2 calls. Slowest were:

2.0ms
(/ (+ N 1) N)
1.0ms
(log (/ (+ N 1) N))

series55.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

35.0ms
(log (/ (+ N 1) N))
19.0ms
(/ (+ N 1) N)

simplify338.0ms

Counts
16 → 35
Calls

16 calls. Slowest were:

128.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
110.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
58.0ms
(- N (+ (log N) (* 1/2 (pow N 2))))

prune282.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize9.0ms

Local error

Found 1 expressions with local error:

2.9b
(log (+ (/ 1 N) 1))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
1 → 14
Calls

1 calls. Slowest were:

2.0ms
(log (+ (/ 1 N) 1))

series27.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

27.0ms
(log (+ (/ 1 N) 1))

simplify400.0ms

Counts
9 → 17
Calls

9 calls. Slowest were:

105.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
100.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
78.0ms
(- N (+ (log N) (* 1/2 (pow N 2))))

prune148.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.1b

localize32.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ 1/3 N)
0.3b
(/ 1 (* N N))
0.1b
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
0.0b
(- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

11.0ms
(- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))
9.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
1.0ms
(/ 1 (* N N))

series69.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

33.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
21.0ms
(- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))
8.0ms
(/ 1 (* N N))
7.0ms
(/ 1/3 N)

simplify7.2s

Counts
49 → 86
Calls

49 calls. Slowest were:

523.0ms
(- (* 1 (* (* N N) (+ (* 1/2 1/2) (+ (* (/ 1/3 N) (/ 1/3 N)) (* 1/2 (/ 1/3 N)))))) (* N (* 1 (- (pow 1/2 3) (pow (/ 1/3 N) 3)))))
437.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
429.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))

prune577.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.1b

regimes68.0ms

Accuracy

99.9% (0.0b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 29.5b

bsearch35.0ms

end0.0ms

sample3.0s

Algorithm
intervals