https://en.wikipedia.org/wiki/Stirling's_approximation
Here $$\sum \limits_{i=1}^n \log(i) $$ is approximated as $$\int^n_1\log(x) dx\ +\ 1/2\ \log(n)$$ but I would approximate it as $$\int^{n+1/2}_{0.5}\log(x)dx$$ clearly my method gives the wrong answer. Can someone explain to me how 1/2 logn term is decided?
ADDITION: For example, if I wanted to approximate $$\sum \limits_{i=1}^{100} i^{-2} $$ I would actually sum the first 10 terms, and then add a correction term using integration. What I would do is, I would add the integral of 1/x^2 from 10.5 to 100.5 (sort of like a midpoint rule). What this rule suggests I do is to integrate from 11 to 100 and then add 1/2(1/11^2 + 1/100^2). I actually did this and my term is accurate within 7.1677e-05 and the trapezoid is accurate within -1.2485e-04.
Final Edit: https://i.stack.imgur.com/kdPu2.png
My approximation actually provides a better approximation anyway.
They are using the trapezoid rule over $n-1$ intervals: $(1,2), (2,3) \dots (n-1,n)$ The trapezoid rule for the first interval is $\int_1^2f(x)\;dx \approx \frac 12(f(1)+f(2))$ When you add these up over all the intervals, each internal point gets a coefficient $1$, with $\frac 12$ coming from the interval below and $\frac 12$ from the interval above but the end terms retain the factor $\frac 12$. This gives $$\sum_{i=1}^n f(i) \approx \int_1^n f(x)\; dx +\frac 12 f(1)+\frac 12 f(n)$$ Using $f(x)=\log x$ and the fact that $\log 1=0$ we get the Wikipedia result.
Your approximation is not wrong or silly. You have applied the midpoint rule to the intervals $(1/2,3/2),(3/2,5/2)\dots (n-\frac 12,n+\frac 12)$ The result is $\left. x \log x \right|_{0.5}^{n+\frac 12}=(n+\frac 12) \log(n+\frac 12)-\frac 12\log \frac 12$ which only differs from the trapezoid rule result by the $+\frac12$ in the argument of the log and the addition of the constant $\frac 12 \log 2$. You have the same asymptotic form and the $+\frac 12$ is equivalent (for large $n$) to adding $\frac 12$ It would take a careful error analysis to see which is more accurate.