Integrating a 'twisted' rational function
For $x\in [0,1]$, let $$ P_n (x) = \prod_{k=1}^{n} (x^k+1)^{(-1)^k}. $$For example, $\displaystyle{P_4(x) = \frac{(x^2+1)(x^4+1)}{(x+1)(x^3+1)}}$. Of note: $P_n(1)=1/2$ if $n$ is odd and $1$ if $n$ is even, so we cannot expect uniform convergence on $[0,1)$. I am interested in the limit $\lim_{n\to\infty}P_n(x)$, if it exists, and several related integrals, namely:
- Whether $P(x):=\lim_{n\to\infty}P_n(x)$ exists and if so what it is
- $I_n:=\int_0^1 P_n(x)\,dx$ (this seems to be the natural range of integration since we want to avoid negative numbers and the even-index version blows up for $x>1$)
- $I:=\int_0^1 P(x)\,dx$
I calculated the first few values of $I_n$ by hand: $$ \left\{\log (2),\log (4)-\frac{1}{2},\frac{1}{27} \left(9+2 \sqrt{3} \pi \right),\frac{5}{2}+\frac{\pi }{9 \sqrt{3}}-\frac{8 \log (2)}{3}\right\} $$Then I computed $20$ values using a CAS; the sequence appears to be alternating with the odd values increasing and the even values decreasing (as expected). I got $I_{1000}\approx 0.79496$ and $I_{1001}\approx 0.794376$, so I would guess the limit $I$ is somewhere in between them.
I've seen infinite products before, mostly in the context of some introductory material I've read on hypergeometric series, so feel free to use them in your answer!
The infinite product $$P(x) = \prod_{k=1}^\infty (x^k+1)^{(-1)^k}$$ converges to a nonzero value if $|x| < 1$ because $$\sum_{k=1}^\infty \log \left((x^k+1)^{(-1)^k}\right) = \sum_{k=1}^\infty (-1)^k \log(x^k+1)$$ converges. Its Maclaurin series coefficients are OEIS sequence A083365. According to that, $P(x) = \psi(x) / \phi(x)$ where $\psi(x)$ and $\phi(x)$ are Ramanujan theta functions.