22
$\begingroup$

Is there a closed form for: $$I(p)=\int_0^\infty \frac{1+z^2}{1+z^4} \frac{z^p}{1+z^{2p}} dz$$

The integral has a number of nice properties:

$$I(p)=I(-p)$$

$$I(p)=2\int_0^1 \frac{1+z^2}{1+z^4} \frac{z^p}{1+z^{2p}} dz=2\int_1^\infty \frac{1+z^2}{1+z^4} \frac{z^p}{1+z^{2p}} dz$$

$$I(p)=\int_{0}^{\infty} \frac{\cosh y}{\cosh 2y} \frac{dy}{\cosh p y}$$

I'm pretty sure it has a closed form expression for every rational $p$, because then we will be able to get a rational function under the integral either directly or with a simple substitution.

Some examples of closed form expressions:

$$I(0)=\frac{\pi}{2 \sqrt{2}}$$

$$I(1)=\frac{\pi}{4}$$

$$I(2)=\frac{\pi}{4 \sqrt{2}}$$

$$I(3)=\left(\frac{2}{3 \sqrt{3}}-\frac{1}{4} \right)\pi$$

$$I(4)=\left(\sqrt{\frac{1}{2} \left(1+\frac{1}{\sqrt{2}}\right)}-\frac{1}{\sqrt{2}} \right)\frac{\pi}{2}$$

$$I(5)=\left(\frac{\sqrt{10(5+\sqrt{5})}}{25}-\frac{1}{4} \right)\pi$$

$$I \left( \frac{1}{2} \right)=\left(\sqrt{1+\frac{1}{\sqrt{2}}}-1 \right)\pi$$

$$I \left( \frac{1}{3} \right)=\left(\frac{1}{\sqrt{3}}-\frac{1}{4} \right)\pi$$

$$I \left( \frac{1}{4} \right)=\left(2-\sqrt{2+\sqrt{2-\sqrt{2}}}\right)\pi$$

$$I \left( \frac{1}{5} \right)=\left(\frac{2\sqrt{5}-1}{4}-\frac{1}{2}\sqrt{2-\frac{2}{\sqrt{5}}}\right)\pi$$

Some not very nice closed forms also appear:

$$I \left( \frac{2}{7} \right)=\frac{ \pi}{8} \left(7 \sqrt{2}+ 4 \sin ^3\left(\frac{\pi }{14}\right) \sin \left(\frac{3 \pi }{14}\right) \csc ^6\left(\frac{\pi }{7}\right) \times \\ \times \left(48 \sin ^2\left(\frac{\pi }{14}\right) \sin \left(\frac{5 \pi }{28}\right) \sin ^2\left(\frac{3 \pi }{14}\right)-4 \sin \left(\frac{\pi }{28}\right) \sin \left(\frac{3 \pi }{14}\right)+\sin \left(\frac{\pi }{14}\right) \times \\ \times \left(2 \sin \left(\frac{3 \pi }{28}\right)-\sin \left(\frac{3 \pi }{14}\right) \left(2 \csc \left(\frac{\pi }{28}\right)+\csc \left(\frac{3 \pi }{28}\right)-3 \csc \left(\frac{5 \pi }{28}\right)\right)\right)\right)\right)$$

Because we can only consider the case $z<1$ a series solution is possible, but the series contain the polygamma function and it's not very useful.

A similar integral has a simple closed form:

$$\int_0^{\infty } \frac{1+z^2}{1+z^4} z^p \, dz=\frac{\pi}{4} \left(\csc \left(\frac{\pi}{4} (p+1)\right)+\sec \left(\frac{\pi}{4} (p+1)\right)\right)$$

This strongly hints on the Beta function, however the series expansion of the original integral will not work, beacuse the limits will be either $\int_0^1$ or $\int_1^\infty$, thus even the series of trigonometric functions doesn't seem possible here.

Mathematica gives:

$$\int_0^1 \frac{1+z^2}{1+z^4} z^p \, dz=\frac{1}{8} \left(\psi \left(\frac{p+5}{8}\right)+\psi\left(\frac{p+7}{8}\right)-\psi\left(\frac{p+1}{8}\right)-\psi \left(\frac{p+3}{8}\right)\right)$$

Is a closed form possible for $I(p)$ for general $p$, not represented as an infinite series of polygamma functions, but something nicer?

Maybe contour integration can help here?

As a separate question, could it be possible to find an ODE for $I(p)$ as a function? It would be almost as good as a closed form to me.

The motivation is this question.


An asymptotic series for $p \to 0$ (obtained by integration of the Taylor series by term) starts as:

$$I(p) \approx \frac{\pi}{2 \sqrt{2}} \left( 1-\frac{3 \pi ^2 p^2}{32}+\frac{95 \pi ^4 p^4}{2048}-\frac{18727 \pi ^6 p^6}{327680}+\frac{23151383 \pi ^8 p^8}{176160768}-\dots \right)=$$

$$=\sum_{n=0}^m (-1)^n \frac{A000364(n) A000281(n)}{(2n)!} \frac{\pi^{2n}}{4^{2n}}p^{2n}$$

The numerator is a product of A000364 and A000281. However, this series does not converge - the numerator grows faster than the denominator for all $p$ as far as I can see.


Update:

Thanks to this great answer we can state the following:

$$I(p)=\frac{\sqrt{2}}{p}I \left( \frac{2}{p} \right)$$

From this functional equation we can see that $p=\sqrt{2}$ is a special value.

$\endgroup$
  • $\begingroup$ i think for rational p the residue theorem will give definitly an answer as a sum of finitely many residues. For all other cases i have strong doubts $\endgroup$ – tired Jan 13 '17 at 18:48
  • $\begingroup$ @tired, what about a finite sum of special functions? I just don't like an infinite series of digammas as an answer $\endgroup$ – Yuriy S Jan 13 '17 at 18:49
  • $\begingroup$ I think in the $\cosh(y)$ form, the limits go from $-\infty$ to $\infty$ (I arrived there with $z=e^{y}$) (Could be relevant for some solution through symmetry). $\endgroup$ – packetpacket Jul 26 '18 at 20:57
  • $\begingroup$ @YuriyS What about the Ramanujan Master Theorem in this case ? $\endgroup$ – user448747 Aug 5 '18 at 11:48
  • $\begingroup$ @tired New version of my answer. The odd case detalized. $\endgroup$ – Yuri Negometyanov Aug 9 '18 at 16:47
6
+50
$\begingroup$

The task contains the rational parameter $p$, which can be integer or irreducible fraction.

$$\color{brown}{\textbf{Integer parameter $p$.}}$$

$$I(p) = \int\limits_0^\infty\dfrac{1+z^2}{1+z^4}\dfrac{z^p}{1+z^{2p}} \,\mathrm dz.\tag1$$

If parameter $p$ is even, then the residue theorem can be applied immediately.

However, the case $p=4q+2$ requires separate consideration, due to the multiple poles.

If parameter $p$ is odd, then the function under the integral can be presented as the sum of the simple terms.

$\color{blue}{\textbf{Case $p=4q$.}}$

Using residue theorem, one can get \begin{align} &I(p) = \dfrac12\int\limits_{-\infty}^\infty\dfrac{1+z^2}{1+z^4}\dfrac{z^p}{1+z^{2p}}\,\mathrm dz = \pi i \sum\limits_{\large{k, \Im z_k>0}}\mathop{\mathrm{Res}}\limits_{\large{z_k}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q}}{1+z^{8q}}\\ & = \pi i\left(\mathop{\mathrm{Res}}\limits_{\large{e^{\frac14\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q}}{1+z^{8q}} + \mathop{\mathrm{Res}}\limits_{\large{e^{\frac34\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q}}{1+z^{8q}} + \sum\limits_{\large{k=0}}^{\large{4q-1}}\ \mathop{\mathrm{Res}}\limits_{\large{e^{\frac{2k+1}{8q}\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q}}{1+z^{8q}}\right)\\ & = \pi i\left(\lim\limits_{\large{z\to e^{\frac14\pi i}}}\dfrac{1+z^2}{4z^3}\dfrac{z^{4q}}{1+z^{8q}} + \lim\limits_{\large{z\to e^{\frac34\pi i}}}\dfrac{1+z^2}{4z^3}\dfrac{z^{4q}}{1+z^{8q}} + \sum\limits_{\large{k=0}}^{\large{4q-1}}\ \lim\limits_{\large{z\to e^{\frac{2k+1}{8q}\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z}{8qz^{4q}}\right)\\ & = \pi i\left(\dfrac{1+i}{4e^{\frac34\pi i}}\dfrac{(-1)^q}2 + \dfrac{1-i}{4e^{\frac14\pi i}}\dfrac{(-1)^q}2 + \sum\limits_{\large{k=0}}^{\large{4q-1}}\ \dfrac{1+e^{\frac{2k+1}{4q}\pi i}}{1+e^{\frac{2k+1}{2q}\pi i}}\dfrac{e^{\frac{2k+1}{8q}\pi i}}{8qe^{\frac{2k+1}2\pi i}}\right)\\ & = \pi i\left(-\dfrac{(-1)^q\sqrt2}8i - \dfrac{(-1)^q\sqrt2}8i - \dfrac{i}{8q}\sum\limits_{\large{k=0}}^{\large{4q-1}}(-1)^k \dfrac{1+e^{\frac{2k+1}{4q}\pi i}}{e^{\frac{2k+1}{8q}\pi i}}\dfrac{e^{\frac{2k+1}{4q}\pi i}}{1+e^{\frac{2k+1}{2q}\pi i}}\right),\\ &I(4q) = \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac1{2q}\sum\limits_{\large{k=0}}^{\large{4q-1}}(-1)^k\dfrac{\cos\frac{2k+1}{8q}\pi}{\cos\frac{2k+1}{4q}\pi}\right).\tag2\\ \end{align} Formula $(2)$ can be simplified by grouping of the symmetric terms, then \begin{align} &I(4q) = \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac1{2q}\sum\limits_{\large{k=0}}^{\large{2q-1}}(-1)^k\left(\dfrac{\cos\frac{2k+1}{8q}\pi}{\cos\frac{2k+1}{4q}\pi} - \dfrac{\cos\frac{2(4q-k-1)+1}{8q}\pi}{\cos\frac{2(4q-k-1)+1}{4q}\pi}\right)\right)\\ &= \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac1{q}\sum\limits_{\large{k=0}}^{\large{2q-1}}(-1)^k \dfrac{\cos\frac{2k+1}{8q}\pi}{\cos\frac{2k+1}{4q}\pi}\right)\\ &= \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac1{q}\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k\left( \dfrac{\cos\frac{2k+1}{8q}\pi}{\cos\frac{2k+1}{4q}\pi} - \dfrac{\cos\frac{2(2q-1-k)+1}{8q}\pi}{\cos\frac{2(2q-1-k)+1}{4q}\pi}\right)\right)\\ &= \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac1{q}\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \dfrac{\cos\frac{2k+1}{8q}\pi + \sin\frac{2k+1}{8q}\pi}{\cos\frac{2k+1}{4q}\pi}\right)\\ &= \dfrac\pi4 \left((-1)^q\sqrt2 + \dfrac{\sqrt2}{q}\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \dfrac{\sin\left(\frac\pi4 + \frac{2k+1}{8q}\pi\right)}{\sin\left(\frac\pi2+\frac{2k+1}{4q}\pi\right)}\right),\\ &\mathbf{\color{blue}{I(0) = \dfrac\pi{2\sqrt2}}},\tag3\\ &\mathbf{\color{blue}{I(4q) = \dfrac\pi{2q\sqrt2} \left((-1)^q\cdot q + \dfrac12\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \sec\frac{2q+2k+1}{8q}\pi\right),\quad q>0.}}\tag4\\ \end{align} The forms $(3)$ and $(4)$ are closed. Applying $(4),$ one can get the suitable alternative forms: \begin{align} &\mathbf{\color{green}{I(4) = \dfrac\pi{2\sqrt2}\left(\sqrt2\cos\frac\pi8-1\,\right) = \dfrac\pi4\left(\sqrt{2+\sqrt2}-\sqrt2\,\right)}},\\ &\mathbf{\color{green}{I(8) = \dfrac\pi{4\sqrt2}\left(2-\sqrt{2+\sqrt{2-\sqrt2}}\,\right)}},\\ &\mathbf{\color{green}{I(12) = \dfrac\pi{6\sqrt2}\left(\sqrt{7+\sqrt{\frac{49}2-4\sqrt3}}-3\right)}}\\ \end{align} (see also Wolfram Alpha).

If $q=4,$ then \begin{align} &\frac12\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \sec\frac{2q+2k+1}{8q}\pi =\frac1{2\cos\frac{9\pi}{32}} - \frac1{2\cos\frac{11\pi}{32}} + \frac1{2\cos\frac{13\pi}{32}} - \frac1{2\cos\frac{15\pi}{32}},\\[4pt] &\mathbf{\color{green}{I(16) = \dfrac\pi{8\sqrt2}\Bigg(4 + \frac1{\sqrt{2-\sqrt{2-\sqrt{2+\sqrt2}}}} - \frac1{\sqrt{2-\sqrt{2-\sqrt{2-\sqrt2}}}} + \frac1{\sqrt{2-\sqrt{2+\sqrt{2-\sqrt2}}}} - \frac1{\sqrt{2-\sqrt{2+\sqrt{2+\sqrt2}}}}\Bigg)}}\\ \end{align}

$\color{blue}{\textbf{Case $p=4q+2$.}}$

Similarly, using residue theorem and taking in account the multiple roots, one can get \begin{align} &I(p) = \dfrac12\int\limits_{-\infty}^\infty\dfrac{1+z^2}{1+z^4}\dfrac{z^p}{1+z^{2p}}\,\mathrm dz = \pi i \sum\limits_{\large{k, \Im z_k>0}}\mathop{\mathrm{Res}}\limits_{\large{z_k}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}}{1+z^{8q+4}}\\ & = \pi i\left(\mathop{\mathrm{Res}}\limits_{\large{e^{\frac14\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}}{1+z^{8q+4}} + \mathop{\mathrm{Res}}\limits_{\large{e^{\frac34\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}}{1+z^{8q+4}} + {\sum\limits_{\substack{k=0\dots q-1,\\q+1\dots3q,\\3q+2\dots4q+1}}\mathop{\mathrm{Res}} \limits_{\large{e^{\frac{2k+1}{8q+4}\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}}{1+z^{8q+4}}}\right)\\ & = \pi i\left(\lim\limits_{\large{z\to e^{\frac14\pi i}}}\left(\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}\left(z-e^{\frac14\pi i}\right)^2}{1+z^{8q+4}}\right)' + \lim\limits_{\large{z\to e^{\frac34\pi i}}}\left(\dfrac{1+z^2}{1+z^4}\dfrac{z^{4q+2}\left(z-e^{\frac34\pi i}\right)^2}{1+z^{8q+4}}\right)' + {\frac1{8q+4}\sum\limits_{\substack{k=0\dots q-1,\\q+1\dots3q,\\3q+2\dots4q+1}} \lim\limits_{\large{z\to e^{\frac{2k+1}{8q+4}\pi i}}}\dfrac{1+z^2}{1+z^4}\dfrac{z}{z^{4q+2}}}\right)\\ & = \pi i\left(-i(-1)^q\dfrac{\sqrt2}{32q+16} -i(-1)^q\dfrac{\sqrt2}{32q+16} + {\frac1{8q+4}\sum\limits_{\substack{k=0\dots q-1,\\ q+1\dots3q,\\3q+2\dots4q-1}}\dfrac{1+e^{\frac{2k+1}{4q+2}\pi i}}{1+e^{\frac{2k+1}{2q+1}\pi i}}\dfrac{e^{\frac{2k+1}{8q+4}\pi i}}{e^{\frac{2k+1}2\pi i}}}\right)\\ & = \pi i\left(-\dfrac{(-1)^q\sqrt2}{16q+8}i - \dfrac{i}{8q+4}\sum\limits_{\substack{k=0\dots q-1,\\ q+1\dots3q,\\3q+2\dots4q-1}}(-1)^k \dfrac{1+e^{\frac{2k+1}{4q+2}\pi i}}{e^{\frac{2k+1}{8q+4}\pi i}}\dfrac{e^{\frac{2k+1}{4q+2}\pi i}}{1+e^{\frac{2k+1}{2q+1}\pi i}}\right),\\ &I(4q+2) = \dfrac\pi{16q+8}\left((-1)^q\sqrt2 + 2\sum\limits_{\substack{k=0\dots q-1,\\ q+1\dots3q\\3q+2\cdots 4q+1}} (-1)^k \dfrac{\cos\frac{2k+1}{8q+4}\pi}{\cos\frac{2k+1}{4q+2}\pi}\right).\tag5\\ \end{align}

Formula $(5)$ also can be simplified by grouping of the symmetric terms, then \begin{align} &I(4q+2) = \dfrac\pi{16q+8}\left((-1)^q\sqrt2 + 2\sum\limits_{\substack{k=0\dots q-1,\\ q+1\dots2q}}(-1)^k\left(\dfrac{\cos\frac{2k+1}{8q+4}\pi}{\cos\frac{2k+1}{4q+2}\pi} - \dfrac{\cos\frac{2(4q+1-k)+1}{8q+4}\pi}{\cos\frac{2(4q+1-k)+1}{4q+2}\pi}\right)\right)\\ &= \dfrac\pi{16q+8}\left((-1)^q\sqrt2 + 4\sum\limits_{\substack{k=0\dots q-1,\\ q+1\dots2q}} (-1)^k \dfrac{\cos\frac{2k+1}{8q+4}\pi}{\cos\frac{2k+1}{4q+2}\pi}\right)\\ &= \dfrac\pi{16q+8} \left((-1)^q\sqrt2 + 4\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k\left( \dfrac{\cos\frac{2k+1}{8q+4}\pi}{\cos\frac{2k+1}{4q+2}\pi} + \dfrac{\cos\frac{2(2q-k)+1}{8q+4}\pi}{\cos\frac{2(2q-k)+1}{4q+2}\pi}\right)\right)\\ &= \dfrac\pi{16q+8}\left((-1)^q\sqrt2 + 4\sum\limits_{\large{k=0}}^{\large{q-1}} (-1)^k \dfrac{\cos\frac{2k+1}{8q+4}\pi - \sin\frac{2k+1}{8q+4}\pi}{\cos\frac{2k+1}{4q+2}\pi}\right)\\ &= \dfrac\pi{16q+8}\left((-1)^q\sqrt2 + 4\sqrt2\sum\limits_{\large{k=0}}^{\large{q-1}} (-1)^k \dfrac{\sin\left(\frac\pi4-\frac{2k+1}{8q+4}\pi\right)}{\sin\left(\frac\pi2-\frac{2k+1}{4q+2}\pi\right)}\right),\\ &\mathbf{\color{blue}{I(4q+2) = \dfrac\pi{(8q+4)\sqrt2} \left((-1)^q + 2\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \sec\frac{q-k}{4q+2}\pi\right).}}\tag6\\ \end{align} The form $(6)$ is closed and allows to get the suitable alternative forms: \begin{align} &\mathbf{\color{green}{I(2) = \dfrac\pi{4\sqrt2}}},\\ &\mathbf{\color{green}{I(6) = \dfrac\pi{12\sqrt6}(4-\sqrt3)}},\\ &\mathbf{\color{green}{I(10) = \dfrac\pi{20\sqrt{10}}\left(10-\sqrt5-2\sqrt2\sqrt{5-\sqrt5}\right)}}\\ \end{align} (see also Wolfram Mathworld).

$\color{blue}{\textbf{Case $p=2q+1$.}}$

Taking in account the polynomials factorization in the forms of \begin{align} &1+z^{4q+2} = \prod\limits_{k=0}^{4q+1} \left(z-\large{e^{\frac{2k+1}{4q+2}\pi i}}\right) = \prod\limits_{k=0}^{2q}\left(z^2-2z\cos\dfrac{2k+1}{4q+2}\pi+1\right)\\[4pt] & = (1+z^2)\prod\limits_{k=0}^{q-1}\left(z^2-2z\cos\dfrac{2k+1}{4q+2}\pi+1\right)\left(z^2-2z\cos\dfrac{2(2q-k)+1}{4q+2}\pi+1\right)\\[4pt] & = (1+z^2)\prod\limits_{k=0}^{q-1}\left(z^2-2z\cos\dfrac{2k+1}{4q+2}\pi+1\right)\left(z^2+2z\cos\dfrac{2k+1}{4q+2}\pi+1\right),\\[4pt] & = (1+z^2)\prod\limits_{k=1}^{q}\left(z^2-2z\cos\dfrac{2k-1}{4q+2}\pi+1\right)\left(z^2+2z\cos\dfrac{2k-1}{4q+2}\pi+1\right),\\[4pt] &1+z^4 = (1+z^2)^2 -2z^2 = \left(z^2-2z\cos\dfrac\pi4+1\right)\left(z^2+2z\cos\dfrac\pi4+1\right),\\ \end{align} the fraction under the integral $(1)$ can be presented in the additive form of $$\begin{align} &f(z,q) = \dfrac{z^{2q+1}}{z^4+1}\dfrac{1+z^2}{1+z^{4p+2}} = \dfrac{2A_0\left(z-\cos\dfrac\pi4\right)+B_0}{z^2-2z\cos\dfrac\pi4+1}+\dfrac{2C_0\left(z+\cos\dfrac\pi4\right)+D_0}{z^2+2z\cos\dfrac\pi4+1}+\sum\limits_{k=1}^q\left(\dfrac{2A_k\left(z-\cos\dfrac{2k-1}{4q+2}\pi\right)+B_k}{z^2-2z\cos\dfrac{2k-1}{4q+2}\pi+1} + \dfrac{2C_k\left(z+\cos\dfrac{2k-1}{4q+2}\pi\right)+D_k}{z^2+2z\cos\dfrac{2k-1}{4q+2}\pi+1}\right), \end{align}\tag7$$ where unknown coefficients $A, B, C, D$ can be defined from the system \begin{cases} 2A_0\left(\large{e^{\frac\pi4i}}-\cos\frac\pi4\right)+B_0 = \lim\limits_{\large{z\to e^{\frac\pi4i}}}(z^2-2z\cos\dfrac\pi4+1)f(z,q)\\[4pt] 2C_0\left(\large{-e^{\frac\pi4i}}+\cos\frac\pi4\right)+D_0 = \lim\limits_{\large{z\to -e^{\frac\pi4i}}}(z^2+2z\cos\dfrac\pi4+1)f(z,q)\\[4pt] 2A_k\left(\large{e^{\frac{2k-1}{4q+2}\pi i}}-\cos\frac{2k-1}{4q+2}\pi\right)+B_k = \lim\limits_{\large{z\to e^{\frac{2k-1}{4q+2}\pi i}}}\left(z^2-2z\cos\dfrac{2k-1}{4q+2}\pi+1\right)f(z,q)\\ 2C_k\left(\large{-e^{\frac{2k-1}{4q+2}\pi i}}+\cos\frac{2k-1}{4q+2}\pi\right)+D_k = \lim\limits_{\large{z\to -e^{\frac{2k-1}{4q+2}\pi i}}}\left(z^2+2z\cos\dfrac{2k-1}{4q+2}\pi+1\right)f(z,q),\tag8\\ \end{cases} which can be simplified, using L'Hospital rule: \begin{align} &2A_0i\sin\frac\pi4+B_0 = \lim\limits_{\large{z\to e^{\frac\pi4i}}}\dfrac{z^{2q+1}+z^{2q+3}}{1+z^{4q+2}}\cdot\lim\limits_{\large{z\to e^{\frac\pi4i}}}\dfrac{z^2-2z\cos\dfrac\pi4+1}{1+z^4}\\[4pt] & = \dfrac{\large{e^{\frac{2q+1}4\pi i}}+e^{\frac{2q+3}4\pi i}}{1+\large{e^{\frac{2q+1}2\pi i}}}\cdot\frac12\lim\limits_{\large{z\to e^{\frac\pi4i}}}\dfrac{z-\cos\dfrac\pi4}{z^3} = \dfrac12\dfrac{\large{e^{\frac{2q+1}4\pi i}}+e^{\frac{2q+3}4\pi i}}{1+\large{e^{\frac{2q+1}2\pi i}}}\cdot\dfrac{i\sin\dfrac\pi4}{\large{e^{\frac34\pi i}}}\\[4pt] & = \dfrac i2\sin\dfrac\pi4\cdot\dfrac{\large{e^{\frac{q-1}2\pi i}}+e^{\frac{q}2\pi i}}{1+\large{e^{\frac{2q+1}2\pi i}}} = \dfrac i2\sin\dfrac\pi4\cdot\dfrac{\large{e^{\frac{2q-1}4\pi i}}}{e^{\frac{2q+1}4\pi i}}\dfrac{\cos\frac\pi4}{\cos\frac{2q+1}4\pi} =\dfrac1{4\cos\frac{2q+1}4\pi}\\[4pt] &=\dfrac12\cos\frac{2q+1}4\pi,\\[4pt] &-2C_0i\sin\frac\pi4+D_0 = \lim\limits_{\large{z\to -e^{\frac\pi4i}}}\dfrac{z^{2q+1}+z^{2q+3}}{1+z^{4q+2}}\cdot\lim\limits_{\large{z\to -e^{\frac\pi4i}}}\dfrac{z^2+2z\cos\dfrac\pi4+1}{1+z^4}\\[4pt] & = \dfrac{\large{-e^{\frac{2q+1}4\pi i}}-e^{\frac{2q+3}4\pi i}}{1+\large{e^{\frac{2q+1}2\pi i}}}\cdot\frac12\lim\limits_{\large{z\to -e^{\frac\pi4i}}}\dfrac{z+\cos\dfrac\pi4}{z^3} = -\dfrac12\dfrac{\large{e^{\frac{2q+1}4\pi i}}+e^{\frac{2q+3}4\pi i}}{1+\large{e^{\frac{2q+1}2\pi i}}}\cdot\dfrac{i\sin\dfrac\pi4}{\large{e^{\frac34\pi i}}}\\[4pt] & = -\dfrac12\cos\frac{2q+1}4\pi,\\[4pt] &2A_ki\sin\frac{2k-1}{4q+2}\pi+B_k = \lim\limits_{\large{z\to e^{\frac{2k-1}{4q+2}\pi i}}}\frac{z^{2q+1}+z^{2q+3}}{1+z^{4}}\cdot\lim\limits_{\large{z\to e^{\frac{2k-1}{4q+2}\pi i}}}\dfrac{z^2-2z\cos\frac{2k-1}{4q+2}\pi+1}{1+z^{4q+2}}\\[4pt] & = \large{e^{\frac{2k-1}2\pi i}}\cdot\frac{1+\large{e^{\frac{2k-1}{2q+1}\pi i}}}{1+\large{e^{\frac{4k-2}{2q+1}\pi i}}}\cdot\normalsize{\frac1{2q+1}}\lim\limits_{\large{z\to e^{\frac{2k-1}{4q+2}\pi i}}}\frac{z-\cos\frac{2k-1}{4q+2}\pi}{z^{4q+1}}\\[4pt] & = \frac1{2q+1}\large{e^{\frac{2k-1}2\pi i}}\frac{1+e^{\frac{2k-1}{2q+1}\pi i}}{1+e^{\frac{4k-2}{2q+1}\pi i}}\cdot\frac{\normalsize{i\sin}\frac{2k-1}{4q+2}\pi}{e^{\frac{2k-1}{4q+2}(4q+1)\pi i}}\\[4pt] & = \frac{(-1)^k}{2q+1}\sin\frac{2k-1}{4q+2}\pi\cdot\frac{1+e^{\frac{2k-1}{2q+1}\pi i}}{1+e^{\frac{4k-2}{2q+1}\pi i}}\cdot\dfrac{e^{\frac{2k-1}{4q+2}\pi i}}{-1}\\[4pt] & = \frac{{(-1)^{k+1}}}{2q+1}\sin\frac{2k-1}{4q+2}\pi\cdot \frac{\cos\frac{2k-1}{4q+2}\pi }{\cos\frac{2k-1}{2q+1}\pi}\cdot\dfrac{\large{e^{\frac{2k-1}{4q+2}\pi i}}e^{\frac{2k-1}{4q+2}\pi i}}{\large{e^{\frac{2k-1}{2q+1}\pi i}}}\\[4pt] & = \frac{(-1)^{k+1}}{4q+2}\tan\frac{2k-1}{2q+1}\pi,\\[4pt] &-2C_ki\sin\frac{2k-1}{4q+2}\pi+D_k = \lim\limits_{\large{z\to -e^{\frac{2k-1}{4q+2}\pi i}}}\frac{z^{2q+1}+z^{2q+3}}{1+z^{4}}\cdot\lim\limits_{\large{z\to -e^{\frac{2k-1}{4q+2}\pi i}}}\dfrac{z^2+2z\cos\frac{2k-1}{4q+2}\pi+1}{1+z^{4q+2}}\\[4pt] & = -\large{e^{\frac{2k-1}2\pi i}}\cdot\frac{1+\large{e^{\frac{2k-1}{2q+1}\pi i}}}{1+\large{e^{\frac{4k-2}{2q+1}\pi i}}}\cdot\normalsize{\frac1{2q+1}}\lim\limits_{\large{z\to -e^{\frac{2k-1}{4q+2}\pi i}}}\frac{z+\cos\frac{2k-1}{4q+2}\pi}{z^{4q+1}}\\[4pt] & = -\frac1{2q+1}\large{e^{\frac{2k-1}2\pi i}}\frac{1+e^{\frac{2k-1}{2q+1}\pi i}}{1+e^{\frac{4k-2}{2q+1}\pi i}}\cdot\frac{\normalsize{i\sin}\frac{2k-1}{4q+2}\pi}{e^{\frac{2k-1}{4q+2}(4q+1)\pi i}}\\[4pt] & = -\frac{(-1)^{k+1}}{4q+2}\tan\frac{2k-1}{2q+1}\pi.\\[4pt] \end{align} Therefore, the coefficients equal to \begin{cases} A_k = C_k = 0,\quad k=0\dots q,\\ B_0 = \dfrac12\cos\frac{2q+1}4\pi\\[4pt] B_k = \frac{(-1)^{k+1}}{4q+2}\tan\frac{2k-1}{2q+1}\pi,\quad k=1\dots q\\[4pt] D_k = -B_k, \quad k=1\dots q,\tag{9} \end{cases} and the decomposition of $(7)$ can be written in the form of \begin{align} &f(z,q) = \dfrac12\cos\frac{2q+1}4\pi\cdot\left(\dfrac1{z^2-2z\cos\dfrac\pi4+1} -\dfrac1{z^2+2z\cos\dfrac\pi4+1}\right)\\[4pt] &+\dfrac1{4q+2}\sum\limits_{k=1}^{q} (-1)^{k+1}\tan\frac{2k-1}{2q+1}\pi\cdot\left(\dfrac{1}{z^2-2z\cos\dfrac{2k-1}{4q+2}\pi+1} - \dfrac1{z^2+2z\cos\dfrac{2k-1}{4q+2}\pi+1}\right)\\[4pt] & = \cos\frac{2q+1}4\pi\cos\dfrac\pi4\cdot\dfrac{2z}{1+z^4}\\[4pt] &+\dfrac1{2q+1}\sum\limits_{k=1}^{q} (-1)^{k+1}\tan\frac{2k-1}{2q+1}\pi\cos\dfrac{2k-1}{4q+2}\pi\cdot\dfrac{2z}{(z^2+1)^2-4z^2\cos^2\dfrac{2k-1}{4q+2}\pi} \\[4pt] & = \cos\frac{2q+1}4\pi\cos\dfrac\pi4\cdot\dfrac{2z}{1+z^4}\\[4pt] &+\dfrac1{2q+1}\sum\limits_{k=1}^{q} (-1)^{k+1}\tan\frac{2k-1}{2q+1}\pi\cos\dfrac{2k-1}{4q+2}\pi\cdot\dfrac{2z}{z^4-2z^2\cos\dfrac{2k-1}{2q+1}\pi+1} \\[4pt] \end{align} $$\begin{align} &f(z,q) = \cos\frac{2q+1}4\pi\cos\dfrac\pi4\cdot\dfrac{2z}{1+z^4}\\[4pt] &+\dfrac1{2q+1}\sum\limits_{k=1}^{q} (-1)^{k+1}\tan\frac{2k-1}{2q+1}\pi\cos\dfrac{2k-1}{4q+2}\pi\cdot\dfrac{2z}{\left(z^2-\cos\dfrac{2k-1}{2q+1}\pi\right)^2+\sin^2\dfrac{2k-1}{2q+1}\pi} \end{align}\tag{10}$$ The sum $(10)$ can be easily integrated, then \begin{align} &I(2q+1) = \left.\cos\frac{2q+1}4\pi\cos\frac\pi4\cdot \mathop{\mathrm{arctan}}z^2\right|_0^\infty\\[4pt] &+\dfrac1{2q+1}\left.\sum\limits_{k=1}^{q} (-1)^{k+1}\dfrac{\cos\frac{2k-1}{4q+2}\pi}{\cos\frac{2k-1}{2q+1}\pi}\cdot\mathop{\mathrm{arctan}}\dfrac{z^2-\cos\dfrac{2k-1}{2q+1}\pi}{\sin\dfrac{2k-1}{2q+1}\pi}\right|_0^\infty\\[4pt] & = \dfrac\pi2\cos\frac{2q+1}4\pi\cos\frac\pi4 +\dfrac1{2q+1}\sum\limits_{k=1}^{q} (-1)^{k+1}\dfrac{\cos\frac{2k-1}{4q+2}\pi}{\cos\frac{2k-1}{2q+1}\pi}\left(\dfrac\pi2+\dfrac\pi2-\frac{2k-1}{2q+1}\pi\right) \end{align} $$\mathbf{\color{blue}{I(p) = \dfrac\pi4\left(2\cos\frac{p}4\pi\cos\frac\pi4 +\dfrac8{p^2}\sum\limits_{k=1}^{\frac{p-1}2} (-1)^{k+1}\left(\frac{p+1}2-k\right)\dfrac{\sin\frac{p+1-2k}{2p}\pi}{\cos\frac{2k-1}{p}\pi}\right).}}\tag{11}$$

The closed form $(11)$ is valid for the odd positive numbers and allows to get the suitable alternative forms: \begin{align} &\mathbf{\color{green}{I(1) = \dfrac\pi4}},\\[4pt] &\mathbf{\color{green}{I(3) = \dfrac\pi4\left(\dfrac89\tan\dfrac\pi3-1\right) = \dfrac\pi4\left(\dfrac8{3\sqrt3}-1\right)}},\\[4pt] &\mathbf{\color{green}{I(5) = \dfrac\pi4\left(\dfrac8{25} \left(2\dfrac{\sin\frac{2}{5}\pi}{\cos\frac{1}{5}\pi}+\dfrac{\sin\frac{1}{5}\pi}{\cos\frac{2}{5}\pi}\right)-1\right)}}\\[4pt] &\mathbf{\color{green}{ = \dfrac\pi{100}\left(32\sin\frac{\pi}{5}+16\sin\frac{2\pi}{5}-25\right) = \dfrac\pi{20}\left(4\sqrt{2+\frac2{\sqrt5}}-5\right).}}\\[4pt] \end{align} If the solution can not be presented through the radicals, expression $(11)$ can be simplified in this case too. For example, \begin{align} &\dfrac4\pi I(7) = \dfrac8{49} \left( 3\dfrac{\sin\frac{3}{7}\pi}{\cos\frac{1}{7}\pi} -2\dfrac{\sin\frac{2}{7}\pi}{\cos\frac{3}{7}\pi} +\dfrac{\sin\frac{1}{7}\pi}{\cos\frac{5}{7}\pi}\right)+1\\[4pt] & = \dfrac8{49} \left( 3\dfrac{\sin\frac{4}{7}\pi}{\cos\frac{1}{7}\pi} +2\dfrac{\sin\frac{2}{7}\pi}{\cos\frac{4}{7}\pi} -\dfrac{\sin\frac{1}{7}\pi}{\cos\frac{2}{7}\pi}\right)+1\\[4pt] &= \dfrac8{49} \dfrac{ 3\sin\frac{4}{7}\pi\cos\frac{2}{7}\pi\cos\frac{4}{7}\pi +2\sin\frac{2}{7}\pi\cos\frac{1}{7}\pi\cos\frac{2}{7}\pi -\sin\frac{1}{7}\pi\cos\frac{1}{7}\pi\cos\frac{4}{7}\pi}{\cos\frac{1}{7}\pi\cos\frac{2}{7}\pi\cos\frac{4}{7}\pi}\cdot \dfrac{\sin\frac{1}{7}\pi}{\sin\frac{1}{7}\pi}+1\\[4pt] &= \dfrac4{49}\left(3\sin\frac{8}{7}\pi\cos\frac{2}{7}\pi+2\cos\frac{1}{7}\pi\sin\frac{4}{7}\pi-\cos\frac{4}{7}\pi\sin\frac{2}{7}\pi\right)\cdot\dfrac{8\sin\frac{1}{7}\pi}{\sin\frac{8}{7}\pi}+1\\[4pt] &= \dfrac{32}{49}\left(3\sin\frac{1}{7}\pi\cos\frac{2}{7}\pi -2\sin\frac{3}{7}\pi\cos\frac{1}{7}\pi -\sin\frac{2}{7}\pi\cos\frac{3}{7}\pi\right)+1\\[4pt] &= \dfrac\pi4\left(\dfrac{16}{49}\left(-2\sin\frac{1}{7}\pi - 3\sin\frac{2}{7}\pi + \sin\frac{3}{7}\pi\right)+1\right)\\[4pt] &\mathbf{\color{green}{I(7) = \dfrac\pi{196}\left(49 - 32\sin\frac{1}{7}\pi - 48\sin\frac{2}{7}\pi + 16\sin\frac{4}{7}\pi\right)}}.\\[4pt] \end{align} \begin{align} &\dfrac4\pi I(9) = \dfrac8{81} \left( 4\dfrac{\sin\frac{4}{9}\pi}{\cos\frac{1}{9}\pi} -3\dfrac{\sin\frac{3}{9}\pi}{\cos\frac{3}{9}\pi} +2\dfrac{\sin\frac{2}{9}\pi}{\cos\frac{5}{9}\pi} -\dfrac{\sin\frac{1}{9}\pi}{\cos\frac{7}{9}\pi}\right)+1\\[4pt] & = \dfrac8{81} \left( 4\dfrac{\sin\frac{4}{9}\pi}{\cos\frac{1}{9}\pi} +\dfrac{\sin\frac{1}{9}\pi}{\cos\frac{2}{9}\pi} -2\dfrac{\sin\frac{2}{9}\pi}{\cos\frac{4}{9}\pi} -6\sin\frac{1}{3}\pi\right)+1\\[4pt] &= \dfrac8{81} \Bigg(\dfrac{ 4\sin\frac{4}{9}\pi\cos\frac{2}{9}\pi\cos\frac{4}{9}\pi +\sin\frac{1}{9}\pi\cos\frac{1}{9}\pi\cos\frac{4}{9}\pi -2\sin\frac{2}{9}\pi\cos\frac{1}{9}\pi\cos\frac{2}{9}\pi }{\cos\frac{1}{9}\pi\cos\frac{2}{9}\pi\cos\frac{4}{9}\pi}\cdot \dfrac{\sin\frac{1}{9}\pi}{\sin\frac{1}{9}\pi}\\[4pt] &-6\sin\frac{1}{3}\pi\Bigg)+1\\[4pt] &= \dfrac{8}{81} \left(\left( 2\sin\frac{8}{9}\pi\cos\frac{2}{9}\pi +\frac12\sin\frac{2}{9}\pi\cos\frac{4}{9}\pi -4\sin\frac{4}{9}\pi\cos\frac{1}{9}\pi \right)\cdot\dfrac{8\sin\frac{1}{9}\pi}{\sin\frac{8}{9}\pi} -3\sin\frac{1}{3}\pi\right)+1\\[4pt] &= \dfrac{16}{81} \left( 8\sin\frac{1}{9}\pi\cos\frac{2}{9}\pi +2\sin\frac{2}{9}\pi\cos\frac{4}{9}\pi -4\sin\frac{4}{9}\pi\cos\frac{1}{9}\pi -3\sin\frac{1}{3}\pi\right)+1\\[4pt] &= \dfrac{\pi}{324} \left(81 -64\sin\frac{1}{9}\pi -16\sin\frac{2}{9}\pi -32\sin\frac{4}{9}\pi\right)\\[4pt] &\mathbf{\color{green}{I(9) = \dfrac{\pi}{324} \left(81 -64\sin\frac{\pi}{9} -16\sin\frac{2\pi}{9} -32\sin\frac{4\pi}{9}\right)}}.\\[4pt] \end{align} Also, for $p=17$ due to Wolfram Alpha can be found the similar closed form: \begin{align} &\dfrac4\pi I(17) = \dfrac8{289} \left( 8\dfrac{\sin\frac{8\pi}{17}}{\cos\frac{\pi}{17}} -7\dfrac{\sin\frac{7\pi}{17}}{\cos\frac{3\pi}{17}} +6\dfrac{\sin\frac{6\pi}{17}}{\cos\frac{5\pi}{17}} -5\dfrac{\sin\frac{5\pi}{17}}{\cos\frac{7\pi}{17}} +4\dfrac{\sin\frac{4\pi}{17}}{\cos\frac{9\pi}{17}} -3\dfrac{\sin\frac{3\pi}{17}}{\cos\frac{11\pi}{17}} +2\dfrac{\sin\frac{2\pi}{17}}{\cos\frac{13\pi}{17}} -\dfrac{\sin\frac{\pi}{17}}{\cos\frac{15\pi}{17}}\right)+1\\[4pt] &= \dfrac8{289} \left( 8\dfrac{\sin\frac{8\pi}{17}}{\cos\frac{\pi}{17}} +\dfrac{\sin\frac{\pi}{17}}{\cos\frac{2\pi}{17}} -2\dfrac{\sin\frac{2\pi}{17}}{\cos\frac{4\pi}{17}} -4\dfrac{\sin\frac{4\pi}{17}}{\cos\frac{8\pi}{17}}\right) +\dfrac8{289}\left( 7\dfrac{\sin\frac{24\pi}{17}}{\cos\frac{3\pi}{17}} +3\dfrac{\sin\frac{3\pi}{17}}{\cos\frac{6\pi}{17}} -6\dfrac{\sin\frac{6\pi}{17}}{\cos\frac{12\pi}{17}} +5\dfrac{\sin\frac{12\pi}{17}}{\cos\frac{24\pi}{17}} \right)+1\\[4pt] &= 1 + \frac{4\sin\frac{\pi}{17}}{289\sin\frac{\pi}{17}} \times \frac{ 8\sin\frac{16\pi}{17}\cos\frac{2\pi}{17}\cos\frac{4\pi}{17} +\sin\frac{2\pi}{17}\cos\frac{4\pi}{17}\cos\frac{8\pi}{17} -2\sin\frac{4\pi}{17}\cos\frac{\pi}{17}\cos\frac{8\pi}{17} -4\sin\frac{8\pi}{17}\cos\frac{\pi}{17}\cos\frac{2\pi}{17}}{\cos\frac{\pi}{17}\cos\frac{2\pi}{17}\cos\frac{4\pi}{17}\cos\frac{8\pi}{17}} + \frac{4\sin\frac{3\pi}{17}}{289\sin\frac{3\pi}{17}}\times \frac{ {7\sin\frac{48\pi}{17}\cos\frac{6\pi}{17}\cos\frac{12\pi}{17}} {+3\sin\frac{6\pi}{17}\cos\frac{12\pi}{17}\cos\frac{24\pi}{17}} {-6\sin\frac{12\pi}{17}\cos\frac{24\pi}{17}\cos\frac{3\pi}{17}} {+5\sin\frac{24\pi}{17}\cos\frac{3\pi}{17}\cos\frac{6\pi}{17}}}{\cos\frac{3\pi}{17}\cos\frac{6\pi}{17}\cos\frac{12\pi}{17}\cos\frac{24\pi}{17}}\\[4pt] \end{align} \begin{align} &= 1 + \frac{64\sin\frac{\pi}{17}}{289\sin\frac{16\pi}{17}} \Big( 8\sin\frac{\pi}{17}\cos\frac{2\pi}{17}\cos\frac{4\pi}{17} +\sin\frac{2\pi}{17}\cos\frac{4\pi}{17}\cos\frac{8\pi}{17} -2\sin\frac{4\pi}{17}\cos\frac{\pi}{17}\cos\frac{8\pi}{17}\\[4pt] &-4\sin\frac{8\pi}{17}\cos\frac{\pi}{17}\cos\frac{2\pi}{17}\Big) + \frac{64\sin\frac{3\pi}{17}}{289\sin\frac{48\pi}{17}} \Big({7\sin\frac{48\pi}{17}\cos\frac{6\pi}{17}\cos\frac{12\pi}{17}}\\[4pt] &{+3\sin\frac{6\pi}{17}\cos\frac{12\pi}{17}\cos\frac{24\pi}{17}} {-6\sin\frac{12\pi}{17}\cos\frac{24\pi}{17}\cos\frac{3\pi}{17}} {+5\sin\frac{24\pi}{17}\cos\frac{3\pi}{17}\cos\frac{6\pi}{17}}\Big)\\[4pt] \end{align} \begin{align} &= 1 + \frac{64}{289}\Bigg( \left(8\sin\frac{\pi}{17}\cos\frac{4\pi}{17} -4\sin\frac{8\pi}{17}\cos\frac{\pi}{17}\right)\cos\frac{2\pi}{17}\\[4pt] &+\left(6\sin\frac{5\pi}{17}\cos\frac{7\pi}{17} -5\sin\frac{7\pi}{17}\cos\frac{6\pi}{17}\right)\cos\frac{3\pi}{17}\\[4pt] &+\left(\sin\frac{2\pi}{17}\cos\frac{4\pi}{17} -2\sin\frac{4\pi}{17}\cos\frac{\pi}{17}\right)\cos\frac{8\pi}{17}\\[4pt] &+\left(3\sin\frac{6\pi}{17}\cos\frac{7\pi}{17} -7\sin\frac{3\pi}{17}\cos\frac{6\pi}{17}\right)\cos\frac{5\pi}{17} \Bigg)\\[4pt] &= 1 + \frac{16}{289}\Bigg( -2\sin\frac{\pi}{17}-3\sin\frac{2\pi}{17}+10\sin\frac{3\pi}{17}-9\sin\frac{4\pi}{17}-16\sin\frac{5\pi}{17}-2\sin\frac{6\pi}{17}+4\sin\frac{7\pi}{17}+10\sin\frac{8\pi}{17}+2\sin\frac{9\pi}{17}-6\sin\frac{10\pi}{17}-6\sin\frac{11\pi}{17}-2\sin\frac{13\pi}{17}-6\sin\frac{14\pi}{17}+6\sin\frac{15\pi}{17}-5\sin\frac{16\pi}{17}+3\sin\frac{18\pi}{17}\Bigg)\\[4pt] &= 1 + \frac{16}{289}\Bigg( -10\sin\frac{\pi}{17}+3\sin\frac{2\pi}{17}+4\sin\frac{3\pi}{17}-11\sin\frac{4\pi}{17}-16\sin\frac{5\pi}{17}-8\sin\frac{6\pi}{17}-2\sin\frac{7\pi}{17}+12\sin\frac{8\pi}{17}\Bigg)\\[4pt] \end{align}

\begin{align} &\mathbf{\color{green}{I(17) = \dfrac\pi4+\dfrac{4\pi}{289}\left(-10\sin\frac{\pi}{17}+3\sin\frac{2\pi}{17}+4\sin\frac{3\pi}{17}-11\sin\frac{4\pi}{17}-16\sin\frac{5\pi}{17}-8\sin\frac{6\pi}{17}-2\sin\frac{7\pi}{17}+12\sin\frac{8\pi}{17}\right).}}\\ \end{align} Obtained form can be presented via radicals: \begin{align} &\mathbf{\color{green}{I(17) = \dfrac\pi4+\dfrac{\pi}{289}S_{17}}},\\ \end{align} \begin{align} &\mathbf{\color{green}{S_{17}=6\sqrt{2{17-\sqrt{17}+\sqrt{2{17-\sqrt{17}}}+\sqrt{2{34+6\sqrt{17}+\sqrt{2{17-\sqrt{17}}}-\sqrt{34{17-\sqrt{17}}}+8\sqrt{2{17+\sqrt{17}}}}}}}-8\sqrt{2{17+\sqrt{17}-\sqrt{2{17+\sqrt{17}}}+\sqrt{2{34-6\sqrt{17}+8\sqrt{2{17-\sqrt{17}}}-\sqrt{2{17+\sqrt{17}}}-\sqrt{34{17+\sqrt{17}}}}}}}-4\sqrt{2{17+\sqrt{17}+\sqrt{2{17+\sqrt{17}}}-\sqrt{2{34-6\sqrt{17}-8\sqrt{2{17-\sqrt{17}}}+\sqrt{2{17+\sqrt{17}}}+\sqrt{34{17+\sqrt{17}}}}}}}-\sqrt{2{17+\sqrt{17}+\sqrt{2{17+\sqrt{17}}}+\sqrt{2{34-6\sqrt{17}-8\sqrt{2{17-\sqrt{17}}}+\sqrt{2{17+\sqrt{17}}}+\sqrt{34{17+\sqrt{17}}}}}}}+3\sqrt{8-\sqrt{2{15+\sqrt{17}+\sqrt{2{17-\sqrt{17}}}-\sqrt{2{34+6\sqrt{17}-\sqrt{2{17-\sqrt{17}}}+\sqrt{34{17-\sqrt{17}}}-8\sqrt{2{17+\sqrt{17}}}}}}}}-11\sqrt{8-\sqrt{2{15+\sqrt{17}-\sqrt{2{17-\sqrt{17}}}-\sqrt{2{34+6\sqrt{17}+\sqrt{2{17-\sqrt{17}}}-\sqrt{34{17-\sqrt{17}}}+8\sqrt{2{17+\sqrt{17}}}}}}}}-10\sqrt{8-\sqrt{2{15+\sqrt{17}-\sqrt{2{17-\sqrt{17}}}+\sqrt{2{34+6\sqrt{17}+\sqrt{2{17-\sqrt{17}}}-\sqrt{34{17-\sqrt{17}}}+8\sqrt{2{17+\sqrt{17}}}}}}}}+4\sqrt{8-\sqrt{2{15-\sqrt{17}-\sqrt{2{17+\sqrt{17}}}+\sqrt{2{34-6\sqrt{17}-8\sqrt{2{17-\sqrt{17}}}+\sqrt{2{17+\sqrt{17}}}+\sqrt{34{17+\sqrt{17}}}}}}}} }}.\\ \end{align}

$$\color{blue}{\textbf{Conclusions.}}$$

The issue integral can be presented in closed form for the non-negative integer values of the parameter $p,$ using the formulas

$$I(p) = \begin{cases} \dfrac\pi{2\sqrt2},\text{ if } p=0\\[4pt] \dfrac\pi{2q\sqrt2} \left((-1)^q\cdot q + \dfrac12\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \sec\frac{2q+2k+1}{8q}\pi\right),\text{ if } p = 4q,\quad q\in\mathbb N\\[4pt] \dfrac\pi{(8q+4)\sqrt2} \left((-1)^q + 2\sum\limits_{\large{k=0}}^{\large{q-1}}(-1)^k \sec\frac{q-k}{4q+2}\pi\right),\text{ if } p=4q+2,\quad q\in\mathbb N\\[4pt] \dfrac\pi4\left(2\cos\frac{p}4\pi\cos\frac\pi4 +\dfrac8{p^2}\sum\limits_{k=1}^{\frac{p-1}2} (-1)^{k+1}\left(\frac{p+1}2-k\right)\dfrac{\sin\frac{p+1-2k}{2p}\pi}{\cos\frac{2k-1}{p}\pi}\right),\text{ if $p$ is odd}. \end{cases}\tag{12} $$

Besides, there were obtained the simplified closed forms in the next partial cases:

$$\begin{cases} I(1) = \dfrac\pi4\\[4pt] I(2) = \dfrac\pi{4\sqrt2}\\[4pt] I(3) = \dfrac\pi4\left(\dfrac89\tan\dfrac\pi3-1\right) = \dfrac\pi4\left(\dfrac8{3\sqrt3}-1\right)\\[4pt] I(4) = \dfrac\pi{2\sqrt2}\left(\sqrt2\cos\frac\pi8-1\,\right) = \dfrac\pi4\left(\sqrt{2+\sqrt2}-\sqrt2\,\right)\\[4pt] I(5) = \dfrac\pi4\left(\dfrac{16}{25}\left(2\sin\frac{1}{5}\pi+\sin\frac{2}{5}\pi\right)-1\right) = \dfrac\pi4\left(\dfrac45\sqrt{2+\frac2{\sqrt5}}-1\right)\\[4pt] I(6) = \dfrac\pi{12\sqrt6}(4-\sqrt3)\\[4pt] I(7) = \dfrac\pi{196}\left(49 - 32\sin\frac{1}{7}\pi - 48\sin\frac{2}{7}\pi + 16\sin\frac{4}{7}\pi\right)\\[4pt] I(8) = \dfrac\pi{4\sqrt2}\left(2-\sqrt{2+\sqrt{2-\sqrt2}}\,\right)\\[4pt] I(9) = \dfrac{\pi}{324} \left(81 -64\sin\frac{\pi}{9} -16\sin\frac{2\pi}{9} -32\sin\frac{4\pi}{9}\right)\\[4pt] I(10) = \dfrac\pi{20\sqrt{10}}\left(10-\sqrt5-2\sqrt2\sqrt{5-\sqrt5}\right)\\[4pt] I(12) = \dfrac\pi{6\sqrt2}\left(\sqrt{7+\sqrt{\frac{49}2-4\sqrt3}}-3\right)\\[4pt] I(16) = \dfrac\pi{8\sqrt2}\Bigg(4 + \frac1{\sqrt{2-\sqrt{2-\sqrt{2+\sqrt2}}}} - \frac1{\sqrt{2-\sqrt{2-\sqrt{2-\sqrt2}}}} + \frac1{\sqrt{2-\sqrt{2+\sqrt{2-\sqrt2}}}} - \frac1{\sqrt{2-\sqrt{2+\sqrt{2+\sqrt2}}}}\Bigg)\\[4pt] I(17) = \dfrac\pi4+\dfrac{4\pi}{289}\left(-10\sin\frac{\pi}{17}+3\sin\frac{2\pi}{17}+4\sin\frac{3\pi}{17}-11\sin\frac{4\pi}{17}-16\sin\frac{5\pi}{17}-8\sin\frac{6\pi}{17}-2\sin\frac{7\pi}{17}+12\sin\frac{8\pi}{17}\right),\tag{13}\\ \end{cases}$$

wherein all solutions with $p>5$ are not in OP. For $p=17$ obtained closed form in radicals.

$$\color{brown}{\textbf{Parameter $p$ is irreducible fraction.}}$$

The simplest way is using formulas of OP for the transformation of the integer solutions.

Another way is the substitutions $$p=\dfrac mn,\quad z=t^n,$$ then $$I(p)=n\int\limits_0^\infty\dfrac{1+t^{2n}}{1+t^{4n}}\dfrac{t^{m+n-1}}{1+t^{2m}}\,\mathrm dt,\tag{14}$$ and to try methods of this answer.

On the other hand, the integral $(14)$ has two parameters, and this makes it very hard.

$\endgroup$
  • $\begingroup$ Thank you for this legendary answer. I am amazed to see that the integral yields such complicated solutions, and very glad such closed forms exist (even if only for some cases). $\endgroup$ – packetpacket Aug 8 '18 at 19:37
  • 1
    $\begingroup$ Very nice answer, thank you! I would still like to know if a form for general $p$, including irrational, exists in terms of special functions, but I doubt it will happen any time soon $\endgroup$ – Yuriy S Aug 8 '18 at 20:31
  • 1
    $\begingroup$ @packetpacket You are welcome! See the case $p=17$ in the updated version. $\endgroup$ – Yuri Negometyanov Aug 9 '18 at 3:09
  • 1
    $\begingroup$ @packetpacket The odd case significantly improved. $\endgroup$ – Yuri Negometyanov Aug 9 '18 at 16:43
  • 1
    $\begingroup$ Just looked at this answer again, and the amount of work you put into it is truly impressive! $\endgroup$ – Yuriy S Jul 4 at 9:25
1
$\begingroup$

A partial answer. Suppose $p=P/Q$, where $P,Q\in\mathbb{Z}$, and that $P$ and $Q$ are not both odd and share no common divisors. Using the residue theorem one can show that \begin{align*}I(p) &= \sum_{m=0}^{\lfloor\frac{4Q-1}{2}\rfloor} (-1)^m \frac{\pi}{4}\left(\cos\frac{(2m+1)\pi}{4} \sec\frac{(2m+1)p\pi}{4}\right) \\ &\hspace{3ex} + \sum_{n=0}^{\lfloor\frac{2P-1}{2}\rfloor} (-1)^n\frac{\pi}{2p}\cos\frac{(2n+1)\pi}{2p}\sec\frac{(2n+1)\pi}{p}, \end{align*} provided that $\cosh 2y$ and $\cosh py$ do not share zeros on the segment of the imaginary axis from $0$ to $i Q\pi$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.