Stirling's approximation from Euler-Maclaurin formula

1k Views Asked by At

I try to derive Stirling's approximation from Euler-Maclaurin formula with form: $$\sum_{x=m}^nf(x)=\int_m^n{f(x)dx}+\frac{f(n)+f(m)}{2}+\sum_{k=2}^p{\frac{(-1)^kB_k}{k!}[f^{(k-1)}(n)-f^{(k-1)}(m)]+\frac{(-1)^{p-1}}{p!}\int_m^n{f^{(p)}(x)P_p(x)dx}}$$ $P_p(x)$ is periodic Bernoulli functions, $B_k$ is Bernoulli number,when $f(x)=\ln(x)$ and $m=1$,get: $$ \sum_{x=1}^n\ln(x)=\int_1^n{\ln(x)dx}+\frac{\ln(n)+\ln(1)}{2}+\sum_{k=2}^p{\frac{(-1)^kB_k}{k!}[\ln^{(k-1)}(n)-\ln^{(k-1)}(1)]+\frac{(-1)^{p-1}}{p!}\int_1^n{f^{(p)}(x)P_p(x)dx}} \\ =n\ln(n)-n+1+\frac{\ln(n)}{2}+\sum_{k=2}^p{\frac{(-1)^kB_k}{k!}\ln^{(k-1)}(n)+\frac{(-1)^{p-1}}{p!}\int_1^n{f^{(p)}(x)P_p(x)dx}} \\ =n\ln(n)-n+1+\frac{\ln(n)}{2}+\sum_{k=2}^p{\frac{(-1)^kB_k}{k!}{\frac{(-1)^{k-1}(k-2)!}{n^{k-1}}}+\frac{(-1)^{p-1}}{p!}\int_1^n{f^{(p)}(x)P_p(x)dx}} \\ =n\ln(n)-n+1+\frac{\ln(n)}{2}+\sum_{k=2}^p{\frac{(-1)^kB_k}{k(k-1)n^{k-1}}+\frac{(-1)^{p-1}}{p!}\int_1^n{f^{(p)}(x)P_p(x)dx}} \\ $$ so that: $$\ln(n!)-\frac{\ln(n)}{2}=\sum_{x=1}^n\ln(x)-\frac{\ln(n)}{2}\\=n\ln(n)-n+1+\sum_{k=2}^p{\frac{(-1)^kB_k}{k(k-1)n^{k-1}}+\frac{(-1)^{p-1}}{p!}\int_1^n{f^{(p)}(x)P_p(x)dx}} $$ but on [wikipedia]:https://en.wikipedia.org/wiki/Stirling%27s_approximation the form is : $$\ln(n!)-\frac{\ln(n)}{2}=n\ln(n)-n+1+\sum_{k=2}^p{\frac{(-1)^kB_k}{k(k-1)}\left(\frac{1}{n^{k-1}}-1\right)+R_{m,n}} $$ Where am I wrong?And what is the actual formula of $R_{m,n}$

1

There are 1 best solutions below

2
On BEST ANSWER

You just sort of dropped that $\ln^{(k-1)}(1)$ term up there, and although $\ln(1)=0$, its derivatives aren't, and that's where wikipedia got $\left(\frac1{n^{k-1}}-1\right)$ vs. your $\frac1{n^{k-1}}$. It doesn't really matter though, because that term could have been $42$ for all that wikipedia did with it in the next line or so when they used the Wallis product to estimate that all the constant stuff amounted to $\frac12\ln(2\pi)$.