Average Error: 28.8 → 0.1
Time: 15.6s
Precision: 64
Internal Precision: 128
\[\log \left(N + 1\right) - \log N\]
\[\begin{array}{l} \mathbf{if}\;N \le 4864.686118700019:\\ \;\;\;\;\log \left(\sqrt[3]{1 + N} \cdot \sqrt[3]{1 + N}\right) + \left(\log \left(\sqrt[3]{1 + N}\right) - \log N\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{N} - \frac{1}{N \cdot N} \cdot \left(\frac{1}{2} - \frac{\frac{1}{3}}{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 < 4864.686118700019

    1. Initial program 0.1

      \[\log \left(N + 1\right) - \log N\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.1

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

      \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{N + 1} \cdot \sqrt[3]{N + 1}\right) + \log \left(\sqrt[3]{N + 1}\right)\right)} - \log N\]
    5. Applied associate--l+0.1

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

    if 4864.686118700019 < N

    1. Initial program 59.4

      \[\log \left(N + 1\right) - \log N\]
    2. Taylor expanded around inf 0.1

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

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

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

Reproduce

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

Details

Time bar (total: 15.2s)Debug log

sample127.0ms

Algorithm
intervals
Results
32.0ms45×body1280valid
23.0ms48×body640valid
22.0ms284×body80nan
15.0ms126×body80valid
9.0ms27×body320valid
2.0ms11×body160valid

simplify9.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
8.0ms
(- (log (+ N 1)) (log N))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.8b

localize43.0ms

Local error

Found 2 expressions with local error:

3.3b
(- (log (+ N 1)) (log N))
2.6b
(log (+ N 1))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
log-prod
add-sqr-sqrt
add-cube-cbrt
log-div
pow1
add-exp-log
associate--l+
add-log-exp
distribute-lft-out--
flip-+
log-pow
add-cbrt-cube
flip3-+
associate--l-
difference-of-squares
flip--
rem-log-exp
diff-log
flip3--
sub-neg
Counts
2 → 34
Calls
2 calls:
Slowest
13.0ms
(- (log (+ N 1)) (log N))
2.0ms
(log (+ N 1))

series134.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
95.0ms
(- (log (+ N 1)) (log N))
39.0ms
(log (+ N 1))

simplify956.0ms

Counts
22 → 40
Calls
22 calls:
Slowest
243.0ms
(- (+ (/ 1 N) (log -1)) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ -1 N))))
160.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
158.0ms
(- (/ 1 N) (+ (* 1/2 (/ 1 (pow N 2))) (log (/ 1 N))))
116.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
78.0ms
(- (+ N (* 1/3 (pow N 3))) (* 1/2 (pow N 2)))

prune357.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Rules
add-exp-log
pow1
add-cube-cbrt
add-cbrt-cube
*-un-lft-identity
add-sqr-sqrt
add-log-exp
associate-*l*
flip--
div-inv
associate-*r*
flip3--
sub-neg
pow-flip
associate-*r/
prod-exp
distribute-lft-in
frac-2neg
clear-num
rec-exp
frac-times
distribute-rgt-in
inv-pow
cbrt-unprod
*-commutative
associate-*l/
pow-prod-down
associate-/r*
pow2
Counts
4 → 64
Calls
4 calls:
Slowest
5.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
1.0ms
(/ 1 (* N N))
0.0ms
(- 1/2 (/ 1/3 N))
0.0ms
(/ 1/3 N)

series61.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
26.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
19.0ms
(- 1/2 (/ 1/3 N))
8.0ms
(/ 1 (* N N))
7.0ms
(/ 1/3 N)

simplify3.6s

Counts
34 → 76
Calls
34 calls:
Slowest
467.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
464.0ms
(* (- (/ 1/3 N)) (/ 1 (* N N)))
459.0ms
(* (/ 1 (* N N)) (- (/ 1/3 N)))
352.0ms
(* (/ 1 (* N N)) (- 1/2 (/ 1/3 N)))
344.0ms
(* (- (/ 1/3 N)) (/ 1 (* N N)))

prune621.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 2 expressions with local error:

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

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
log-prod
add-sqr-sqrt
associate-/l*
add-exp-log
pow1
associate-/l/
add-log-exp
div-inv
add-cbrt-cube
flip-+
log-pow
rem-log-exp
flip3-+
frac-2neg
clear-num
log-div
Counts
2 → 29
Calls
2 calls:
Slowest
5.0ms
(/ (+ N 1) N)
2.0ms
(log (/ (+ N 1) N))

series74.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
44.0ms
(log (/ (+ N 1) N))
29.0ms
(/ (+ N 1) N)

simplify471.0ms

Counts
16 → 35
Calls
16 calls:
Slowest
164.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
159.0ms
(- (+ (* 1/3 (/ 1 (pow N 3))) (/ 1 N)) (* 1/2 (/ 1 (pow N 2))))
85.0ms
(- N (+ (log N) (* 1/2 (pow N 2))))
13.0ms
(- (* N N) (* 1 1))
8.0ms
(+ (pow N 3) (pow 1 3))

prune225.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

24.5b
(+ (log (* (cbrt (+ N 1)) (cbrt (+ N 1)))) (- (log (cbrt (+ N 1))) (log N)))
2.7b
(log (cbrt (+ N 1)))
2.7b
(log (* (cbrt (+ N 1)) (cbrt (+ N 1))))
0.4b
(- (log (cbrt (+ N 1))) (log N))

rewrite55.0ms

Algorithm
rewrite-expression-head
Rules
28×*-un-lft-identity
28×cbrt-div
24×pow1
20×log-prod
20×log-div
19×log-pow
15×flip-+
15×flip3-+
12×associate--l+
12×add-sqr-sqrt
10×add-cube-cbrt
distribute-lft-out
cbrt-prod
distribute-lft-out--
associate-+l-
add-exp-log
associate-+r+
frac-times
add-log-exp
pow-prod-down
pow1/3
associate-*r/
associate-*l/
add-cbrt-cube
rem-log-exp
pow-prod-up
diff-log
sub-neg
sum-log
associate--l-
difference-of-squares
flip--
prod-exp
flip3--
pow-plus
associate-+r-
associate-+l+
+-commutative
pow2
Counts
4 → 105
Calls
4 calls:
Slowest
30.0ms
(+ (log (* (cbrt (+ N 1)) (cbrt (+ N 1)))) (- (log (cbrt (+ N 1))) (log N)))
11.0ms
(log (* (cbrt (+ N 1)) (cbrt (+ N 1))))
10.0ms
(- (log (cbrt (+ N 1))) (log N))
2.0ms
(log (cbrt (+ N 1)))

series310.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
109.0ms
(+ (log (* (cbrt (+ N 1)) (cbrt (+ N 1)))) (- (log (cbrt (+ N 1))) (log N)))
74.0ms
(log (* (cbrt (+ N 1)) (cbrt (+ N 1))))
67.0ms
(log (cbrt (+ N 1)))
61.0ms
(- (log (cbrt (+ N 1))) (log N))

simplify3.5s

Counts
77 → 117
Calls
77 calls:
Slowest
409.0ms
(- (log (cbrt (sqrt (+ N 1)))) (log N))
312.0ms
(- (+ (log (/ 1 N)) (+ (* 1/3 (/ 1 N)) (log (pow (/ 1 N) -1/3)))) (* 1/6 (/ 1 (pow N 2))))
248.0ms
(- (+ (log (/ 1 N)) (+ (/ 1 N) (+ (log (pow (/ 1 N) -1/3)) (log (pow (/ 1 N) -2/3))))) (* 1/2 (/ 1 (pow N 2))))
227.0ms
(- (+ (* 1/3 (/ 1 N)) (* 2/3 (log (/ -1 N)))) (+ (* 1/6 (/ 1 (pow N 2))) (* 2/3 (log -1))))
209.0ms
(- (+ (* 1/3 (/ 1 N)) (* 1/3 (log -1))) (+ (* 1/6 (/ 1 (pow N 2))) (* 1/3 (log (/ -1 N)))))

prune1.3s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes35.0ms

Accuracy

99.9% (0.0b remaining)

Error of 0.1b against oracle of 0.1b and baseline of 31.6b

bsearch60.0ms

end0.0ms

sample3.1s

Algorithm
intervals
Results
1.0s1672×body1280valid
595.0ms8053×body80nan
524.0ms1218×body640valid
504.0ms4170×body80valid
218.0ms650×body320valid
50.0ms291×body160valid