Average Error: 40.9 → 19.9
Time: 26.8s
Precision: 64
Ground Truth: 128
\[\log \left(N + 1\right) - \log N\]
⬇
\[\begin{array}{l}
\mathbf{if}\;N \le 155712.94519128354:\\
\;\;\;\;\log \left(1 + \frac{1}{N}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{{N}^2} + \frac{1}{N}\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if N < 155712.94519128354
Initial program 31.7
\[\log \left(N + 1\right) - \log N\]
- Using strategy
rm
Applied diff-log 29.5
\[\leadsto \color{blue}{\log \left(\frac{N + 1}{N}\right)}\]
Applied taylor 29.5
\[\leadsto \log \left(1 + \frac{1}{N}\right)\]
Taylor expanded around 0 29.5
\[\leadsto \log \color{blue}{\left(1 + \frac{1}{N}\right)}\]
if 155712.94519128354 < N
Initial program 59.8
\[\log \left(N + 1\right) - \log N\]
Applied taylor 0.0
\[\leadsto \left(\frac{1}{3} \cdot \frac{1}{{N}^{3}} + \frac{1}{N}\right) - \frac{1}{2} \cdot \frac{1}{{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}}\]
Applied simplify 0.0
\[\leadsto \color{blue}{\frac{1}{N \cdot N} \cdot \left(\frac{\frac{1}{3}}{N} - \frac{1}{2}\right) + \frac{1}{N}}\]
Applied simplify 0.0
\[\leadsto \color{blue}{\frac{\frac{\frac{1}{3}}{N} - \frac{1}{2}}{{N}^2}} + \frac{1}{N}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(3300460555 843096705 673485548 1507387360 1814934995 3443200150)'
(FPCore (N)
:name "NMSE problem 3.3.6"
(- (log (+ N 1)) (log N)))