Average Error: 29.2 → 0.3
Time: 23.4s
Precision: 64
Internal Precision: 128
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 5454.710586921827:\\ \;\;\;\;\left(\log \left(1 + {N}^{3}\right) - \log \left(N \cdot N + \left(1 - N\right)\right)\right) - \log N\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{N} - \log \left(e^{\left(\frac{1}{2} - \frac{\frac{1}{3}}{N}\right) \cdot \frac{1}{N \cdot 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 < 5454.710586921827

    1. Initial program 0.1

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

      \[\leadsto \log \color{blue}{\left(\frac{{N}^{3} + {1}^{3}}{N \cdot N + \left(1 \cdot 1 - N \cdot 1\right)}\right)} - \log N\]
    4. Applied log-div0.1

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

      \[\leadsto \left(\color{blue}{\log \left(1 + {N}^{3}\right)} - \log \left(N \cdot N + \left(1 \cdot 1 - N \cdot 1\right)\right)\right) - \log N\]

    if 5454.710586921827 < N

    1. Initial program 59.4

      \[\log \left(N + 1\right) - \log N\]
    2. 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}}}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{\frac{1}{N} - \frac{1}{N \cdot N} \cdot \left(\frac{1}{2} - \frac{\frac{1}{3}}{N}\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp0.6

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

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

Reproduce

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

Details

Time bar (total: 23.0s)Debug log

sample118.0ms

Algorithm
intervals

simplify8.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.5b

localize23.0ms

Local error

Found 2 expressions with local error:

2.8b
(log (+ N 1))
2.2b
(- (log (+ N 1)) (log N))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
2 → 34
Calls

2 calls. Slowest were:

8.0ms
(- (log (+ N 1)) (log N))
2.0ms
(log (+ N 1))

series136.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

101.0ms
(- (log (+ N 1)) (log N))
34.0ms
(log (+ N 1))

simplify882.0ms

Counts
22 → 40
Calls

22 calls. Slowest were:

227.0ms
(- (+ (/ 1 N) (log -1)) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ -1 N))))
196.0ms
(- (/ 1 N) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ 1 N))))
95.0ms
(- (+ N (* 1/3 (pow N 3))) (* 1/2 (pow N 2)))

prune364.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize36.0ms

Local error

Found 4 expressions with local error:

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

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

15.0ms
(- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))
9.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
2.0ms
(/ 1 (* N N))

series65.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

26.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
18.0ms
(- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))
14.0ms
(/ 1 (* N N))
8.0ms
(/ 1/3 N)

simplify6.7s

Counts
49 → 86
Calls

49 calls. Slowest were:

476.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
473.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
442.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))

prune645.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

9.1b
(sqrt (- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
9.1b
(sqrt (- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
0.6b
(/ 1 (* N N))
0.6b
(/ 1 (* N N))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

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

series96.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

34.0ms
(sqrt (- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
31.0ms
(sqrt (- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
17.0ms
(/ 1 (* N N))
14.0ms
(/ 1 (* N N))

simplify5.2s

Counts
38 → 80
Calls

38 calls. Slowest were:

828.0ms
(sqrt (- (* (/ 1 N) (/ 1 N)) (* (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))))
813.0ms
(sqrt (- (* (/ 1 N) (/ 1 N)) (* (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N))))))
346.0ms
(sqrt (- (/ 1 N) (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))

prune764.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

1.6b
(log (exp (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
0.6b
(/ 1 (* N N))
0.4b
(/ 1/3 N)
0.1b
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

9.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
5.0ms
(log (exp (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
1.0ms
(/ 1 (* N N))

series111.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

47.0ms
(log (exp (* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))))
39.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
14.0ms
(/ 1 (* N N))
12.0ms
(/ 1/3 N)

simplify4.2s

Counts
44 → 83
Calls

44 calls. Slowest were:

468.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
448.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
386.0ms
(* (- (/ 1/3 N)) (/ 1 (* N N)))

prune768.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes46.0ms

Accuracy

99.1% (0.3b remaining)

Error of 0.3b against oracle of 0.1b and baseline of 31.4b

bsearch57.0ms

end0.0ms

sample2.8s

Algorithm
intervals