Real and imaginary part of Gamma function

Updated
Here we will study $\Gamma$ directly since its behavior is much more regular than $\zeta$ in the critical strip.

Since $\;\overline{\Gamma (z)}=\Gamma (\overline{z})\;$ a first idea is to use any formula for $\;\Gamma(z)\,$ and transform it with : $$\Re\;\Gamma(z)=\frac{\Gamma(z)+\Gamma(\overline{z})}2,\quad\Im\;\Gamma(z)=\frac{\Gamma(z)-\Gamma(\overline{z})}{2\,i}$$

Let's apply this to some integral formulae like the definition $\;\displaystyle\Gamma(z):=\int_0^\infty e^{-t}\,t^{z-1}\,dt$ :

\begin{align} \Re\;\Gamma(x+iy)&=\int_0^\infty e^{-t}\,\frac{t^{x+iy-1}+t^{x-iy-1}}2\,dt\\ &=\int_0^\infty e^{-t}\,t^{x-1}\,\frac{e^{iy\ln(t)}+e^{-iy\ln(t)}}2\,dt\\ &\tag{1}=\int_0^\infty e^{-t}\,t^{x-1}\,\cos(y\;\ln\,t)\;dt\\ \\\\ \Im\;\Gamma(x+iy)&=\int_0^\infty e^{-t}\,\frac{t^{x+iy-1}-t^{x-iy-1}}{2\,i}\,dt\\ \tag{2}&=\int_0^\infty e^{-t}\,t^{x-1}\,\sin(y\;\ln\,t)\;dt\\ \end{align}

The variant $\;\displaystyle\Gamma(z)=2\int_0^\infty e^{-t^2}\,t^{2z-1}\,dt\;$ returned :

\begin{align} \tag{3}\Re\;\Gamma(x+iy)&=2\int_0^\infty e^{-t^2}\,t^{2x-1}\,\cos(2\,y\;\ln\,t)\;dt\\ \tag{4}\Im\;\Gamma(x+iy)&=2\int_0^\infty e^{-t^2}\,t^{2x-1}\,\sin(2\,y\;\ln\,t)\;dt\\ \end{align} with faster convergence and the power of $t$ disappearing for $x=\frac 12$.

While the finite integral $\Gamma(z)=\int_0^1 (-\ln\,t)^{z-1}\,dt\;$ gives : \begin{align} \tag{5}\Re\;\Gamma(x+iy)&=\int_0^1 (-\ln\,t)^{x-1}\,\cos(y\;\ln(-\ln(t)))\;dt\\ \tag{6}\Im\;\Gamma(x+iy)&=\int_0^1 (-\ln\,t)^{x-1}\,\sin(y\;\ln(-\ln(t)))\;dt\\ \end{align}

We could try the same idea with infinite series and products from Abramowitz and Stegun but let's experiment another idea.


We may use $\;\displaystyle\Gamma(z)=|\Gamma(z)|\;e^{i\arg \Gamma(z)}\;$ to get : \begin{align} \Re\;\Gamma(z)&=\left|\Gamma(z)\right|\;\cos(\arg\;\Gamma(z))\\ \Im\;\Gamma(z)&=\left|\Gamma(z)\right|\;\sin(\arg\;\Gamma(z))\\ \end{align}

Let's obtain some moduli (absolute values) first :

As proposed by Kunnysan we may consider $\;\displaystyle\Gamma(z)\,\Gamma(1-z)=\frac{\pi}{\sin(\pi z)}\,$ applied to $z=\frac 12+iy\;$ and conclude using $\;\Gamma(\overline{z})=\overline{\Gamma (z)}\;$ that : $$\tag{7}\left|\Gamma\left(\frac 12+iy\right)\right|=\sqrt{\frac{\pi}{\cosh(\pi\,y)}}$$ A more general formula from Mathias Lerch (but without explicit $\lambda(y)$) is for $0\le x\le 1$ : $$\left|\Gamma\left(x+iy\right)\right|=\lambda(y)\frac{\Gamma(1+x)}{\sqrt{x^2+y^2}}\sqrt{\frac{\pi\;y}{\sin(\pi\,y)}}\quad\text{with}\ \ 1\le\lambda(y)\le\sqrt{1+y^2}$$ From A&S $6.1.25$ we have too : $$\tag{8}\left|\Gamma\left(x+iy\right)\right|=\frac {\left|\Gamma(x)\right|}{\sqrt{\prod\limits_{n=0}^\infty 1+\frac {y^2}{(x+n)^2}}}$$

For numerical evaluation Stirling approximation may be useful :

$$\tag{9}\left|\Gamma\left(x+iy\right)\right|=\sqrt{2\pi}\,e^{-\pi|y|/2}\,|y|^{x-1/2}[1+r(x,y)]$$ with $|r(x,y)|\to 0$ uniformly for $x<K$ as $|y|\to\infty$.
(the error is around $1$% for $y=1$ and quickly decreasing with $y$ ; we will derive a similar but more precise formula in a moment)

While the argument of $\;\Gamma(x+iy)$ is given by A&S $6.1.27$ (if $\;x+iy\neq 0,-1,-2,\cdots$) : $$\tag{10}\arg\;\Gamma(x+iy)=y\;\psi(x)+\sum_{n=0}^\infty\left[\frac y{x+n}-\arctan\frac y{x+n}\right]$$ with $\psi(x)=\dfrac{\Gamma'(x)}{\Gamma(x)}$ the psi or digamma function.

Observing that the argument is simply the imaginary part of $\,\ln\;\Gamma(z)\,$ we may use the asymptotic expansion $\ 6,1,40\,$ as $z\to\infty\,$ valid for $\,|\arg\;z|<\pi\,$ and with $B_n$ the Bernoulli numbers : \begin{align} \arg\,\Gamma(z)&\sim \Im\left[\left(z-\frac 12\right)\ln(z)-z+\frac 12\ln(2\pi)+\sum\limits_{m=1}^\infty \frac{B_{2m}}{2m\,(2m-1)}z^{1-2m}\right]\quad(11)\\ &\sim \Im\left(z-\frac 12\right)\Re\;\ln(z)+\Re\left(z-\frac 12\right)\Im\;\ln(z)-\Im\;z+\sum\limits_{m=1}^\infty \frac{B_{2m}}{2m\,(2m-1)}\Im\;{z^{1-2m}}\\ &\sim \frac{y\;\ln\bigl(x^2+y^2\bigr)}2+\left(x-\frac 12\right)\arg(x+iy)-y-\frac 1{12}\frac y{x^2+y^2}+\frac 1{360}\frac{3x^2y-y^3}{(x^2+y^2)^3}+\cdots\\ \end{align} (for $\,\Re(x)>0$ you may replace $\,\arg(x+iy)\,$ by $\,\arctan\dfrac yx\,$ ; see arg for other quadrants)

The corresponding modulus is given by : \begin{align} |\Gamma(z)|&\sim \exp\;\Re\left[\left(z-\frac 12\right)\ln(z)-z+\frac 12\ln(2\pi)+\sum\limits_{m=1}^\infty \frac{B_{2m}\;z^{1-2m}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\exp\left[\Re\left(z-\frac 12\right)\Re\;\ln(z)-\Im\left(z-\frac 12\right)\Im\;\ln(z)-\Re\;z+\sum\limits_{m=1}^\infty \frac{B_{2m}\;\Re\;{z^{1-2m}}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\exp\left[\frac{\left(x-\frac 12\right)\;\ln\bigl(x^2+y^2\bigr)}2-y\;\arg(x+iy)-x+\sum\limits_{m=1}^\infty \frac{B_{2m}\;\Re\;{z^{1-2m}}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\bigl(x^2+y^2\bigr)^{\frac x2-\frac 14}\exp\left[-x-y\,\arg(x+iy)+\frac 1{12}\frac x{x^2+y^2}-\frac 1{360}\frac{x^3-3xy^2}{(x^2+y^2)^3}+\cdots\right]\\ \end{align}

Combining these two formulas should provide accurate real and imaginary parts except near the negative axis.

Let's add that approximations for the $\Gamma$ function is a rather well studied subject and that the Lanczos approximation for example was often used in the critical strip.


Some illustrations to conclude :

The real part of $\Gamma$

real part

The imaginary part of $\Gamma$ imaginary part

The modulus of $\Gamma$ (note the regularity of the surface at the right of the pole at $0$)

abs gamma