Integrate $1/(x_1x_2\cdots x_n)^k$ for $1\le x_i \le a$, where product of coordinates satisfies $ b\le x_1\cdots x_n\le c$

UPDATE 2019-05-31. Formulae are corrected and SageMath code added.

Let us assume that $a$ is fixed, and define: $$ I_n^{k,l}(b,c) := \iiiint_{[1,a]^n} \frac {\chi(\{ b \le x_1 \cdots x_n \le c \})\log(x_1 x_2 \cdots x_n)^l} {( x_1 x_2 \cdots x_n)^k} \,dx_1 \cdots dx_n. $$ Hence, the integral in question equals $I_n^{k,0}(b,c)$.

We first consider the case $b\leq\frac{c}a$, while the other case is considered similarly.

We will need the following formula, which holds for all integer $l\geq 0$: $$\int \frac{\log(y)^l}{y^k}dy = \begin{cases} \frac{\log(y)^{l+1}}{l+1}, & \text{if }k=1;\\ -\sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(y)^i}{y^{k-1}} & \text{if }k\ne 1. \end{cases}$$

Making a substitution $x_n := \frac{t}{x_1\cdots x_{n-1}}$, we get $$I_n^{k,l}(b,c) = \int_1^a dx_1 \cdots \int_1^a dx_{n-1} \int_{x_1\cdots x_{n-1}}^{ax_1\cdots x_{n-1}} dt\frac{\log(t)^l\chi(b\leq t\leq c)}{t^k x_1\cdots x_{n-1}}.$$

If $k\ne 1$, depending on the value of $x_1\cdots x_{n-1}$ the last integral breaks into 4 cases:

  • If $x_1\cdots x_{n-1}\leq \frac{b}{a}$ or $x_1\cdots x_{n-1}\geq c$, then the integral over $t$ is zero.
  • If $\frac{b}{a} \leq x_1\cdots x_{n-1}\leq b$, then the integral over $t$ equals $$-\sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(ax_1\cdots x_{n-1})^i}{a^{k-1}(x_1\cdots x_{n-1})^k} + \sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(b)^i}{b^{k-1}x_1\cdots x_{n-1}}$$
  • If $b\leq x_1\cdots x_{n-1}\leq \frac{c}{a}$, then the integral over $t$ equals $$-\sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(ax_1\cdots x_{n-1})^i}{a^{k-1}(x_1\cdots x_{n-1})^k} + \sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(x_1\cdots x_{n-1})^i}{(x_1\cdots x_{n-1})^k}.$$
  • If $\frac{c}{a}\leq x_1\cdots x_{n-1}\leq c$, then the integral over $t$ equals $$-\sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(c)^i}{c^{k-1}x_1\cdots x_{n-1}} + \sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \frac{\log(x_1\cdots x_{n-1})^i}{(x_1\cdots x_{n-1})^k}$$

Hence, if $b\leq\frac{c}{a}$ and $k\neq 1$, we get a recurrence formula: $$I_n^{k,l}(b,c) = -\sum_{i=0}^l \frac{l!}{i!(k-1)^{l+1-i}} \left( \sum_{j=0}^i \binom{i}{j} \frac{\log(a)^{i-j}}{a^{k-1}} I_{n-1}^{k,j}(\frac{b}{a},\frac{c}{a}) - \frac{\log(b)^i}{b^{k-1}} I_{n-1}^{1,0}(\frac{b}{a},b) - I_{n-1}^{k,i}(b,c) + \frac{\log(c)^i}{c^{k-1}}I_{n-1}^{1,0}(\frac{c}{a},c) \right).$$ It can be easily verified that the same formula holds in the case $b\geq\frac{c}{a}$ as well. In fact, for the original problem, we don't need this formula in full generality, but rather its special case with $l=0$: $$I_n^{k,0}(b,c) = \frac{1}{1-k} \left( \frac{1}{a^{k-1}} I_{n-1}^{k,0}(\frac{b}{a},\frac{c}{a}) - \frac{1}{b^{k-1}} I_{n-1}^{1,0}(\frac{b}{a},b) - I_{n-1}^{k,0}(b,c) + \frac{1}{c^{k-1}}I_{n-1}^{1,0}(\frac{c}{a},c) \right).$$

Similarly, when $k=1$, we get the formula: $$I_n^{1,l}(b,c) = \frac{1}{l+1}\left(\sum_{j=0}^{l+1} \binom{l+1}{j} \log(a)^{l+1-j} I_{n-1}^{1,j}(\frac{b}{a},\frac{c}{a}) - \log(b)^{l+1} I_{n-1}^{1,0}(\frac{b}{a},b) - I_{n-1}^{1,l+1}(b,c) + \log(c)^{l+1} I_{n-1}^{1,0}(\frac{c}{a},c) \right).$$

These formulae allow to compute the integral $I_n^{k,l}(b,c)$ recursively. The recursion stops as soon as $n=1$, $c\leq 1$, or $b\leq 1$ and $c\geq a^n$ -- in all these cases the corresponding integral can be computed explicitly.


SageMath code implementing these formulae:

def II(n,k,l,a,b,c):
  if (c<=1) or (c<=b) or (b>=a^n):
    return 0

  if n==1:
    if k==1:
      return ( log(min(a,c))^(l+1) - log(max(1,b))^(l+1) ) / (l+1)
    return - sum( factorial(l)/factorial(i)/(k-1)^(l+1-i) * ( log(min(a,c))^i/min(a,c)^(k-1) - log(max(1,b))^i/max(1,b)^(k-1) ) for i in range(l+1) )

  if k==1:
    return ( sum( binomial(l+1,j)*log(a)^(l+1-j)*II(n-1,1,j,a,b/a,c/a) for j in range(l+2) ) - log(b)^(l+1)*II(n-1,1,0,a,b/a,b) - II(n-1,1,l+1,a,b,c) + log(c)^(l+1)*II(n-1,1,0,a,c/a,c) ) / (l+1)
  return - sum( factorial(l)/factorial(i)/(k-1)^(l+1-i) * ( sum( binomial(i,j)*log(a)^(i-j)/a^(k-1)*II(n-1,k,j,a,b/a,c/a) for j in range(i+1) ) - log(b)^i/b^(k-1)*II(n-1,1,0,a,b/a,b) - II(n-1,k,i,a,b,c) + log(c)^i/c^(k-1)*II(n-1,1,0,a,c/a,c) ) for i in range(l+1) )