Integral comparison for a nonincreasing nonnegative function (source code)

= Integral comparison for a nonincreasing nonnegative function
{title2=$\int_1^{N+1}f(x)\,dx\leq\sum_{n=1}^Nf(n)\leq f(1)+\int_1^Nf(x)\,dx$}

= Integral comparison
{synonym}

For a nonnegative <nonincreasing function> $f:[1,\infty)\to[0,\infty)$, comparison with unit-width rectangles gives
$$
\int_1^{N+1}f(x)\,dx
\leq\sum_{n=1}^{N}f(n)
\leq f(1)+\int_1^Nf(x)\,dx.
$$
On $[n,n+1]$, the <function> is at most $f(n)$; on $[n-1,n]$, it is at least $f(n)$. Summing these inequalities gives the bounds. Applying them to $f(x)=1/x$ gives $\log(N+1)\leq H_N\leq1+\log N$ for the <harmonic numbers>. Unlike a convergence verdict alone, the finite bounds estimate the size of a <partial sum>.