5
$\begingroup$

I would like to implement the following recurrence relation, $$I_{n+1}=-\log(2)I_n-\sum_{k=1}^n(-1)^k\left(1-\frac{1}{2^k}\right)\frac{n!\zeta(k+1)}{(n-k)!}I_{n-k}$$ with initial conditions, $$I_0=\frac{\pi}{2},\quad I_1=-\frac{\pi}{2}\log(2)$$ This comes from my work on MSE, and I am looking to add the first few values of the integral in my post.

$\endgroup$

1 Answer 1

6
$\begingroup$
Int[0] := Pi/2
Int[1] := -(Pi/2) Log[2]
Int[n_Integer] /; n >= 2 := Int[n] = Simplify[ -Log[2] Int[n - 1] -   
  Sum[(-1)^k (1 - 1/2^k) Factorial[n - 1] Zeta[k + 1] Int[n 
    - 1 - k]/Factorial[n - 1 - k], {k, n - 1}]]

We have exploited so called memoization to memorize previous values and avoid inefficient recursive calling of Int[n]. Then it is recommended to use Simplify instead of FullSimplify for fast performance.

Int[5]
-(1/96) Pi (19 Pi^4 Log[2] + 
20 Pi^2 (2 Log[2]^3 + 3 Zeta[3]) + 
24 (2 Log[2]^5 + 18 Log[2]^2 Zeta[3] + Log[8] Log[16] Zeta[3] + 
 45 Zeta[5]))

Anyway one can use later FullSimplify

FullSimplify[Int[5]]
-(1/96) Pi (19 Pi^4 Log[2] + 40 Pi^2 Log[2]^3 + 
48 Log[2]^5 + 60 (Pi^2 + 12 Log[2]^2) Zeta[3] + 1080 Zeta[5])
$\endgroup$
6
  • $\begingroup$ Thank you! This is exactly what I was looking for :) $\endgroup$
    – bob
    Commented Aug 12, 2023 at 15:57
  • 2
    $\begingroup$ You are welcome. Perhaps it would be useful if we rearrange complicated expressions for larger n, you can compare e.g. FullSimplify[Int[7]] and e.g. Collect[Int[7], Table[Zeta[2 k + 1], {k, 3}], FullSimplify] $\endgroup$
    – Artes
    Commented Aug 12, 2023 at 16:03
  • 1
    $\begingroup$ Is there a way I can distribute a constant? For example I am evaluating $I_2$ and I get, $$\frac{1}{24}\left(\pi^3+12\pi\log(2)\right)$$ but I want, $$\frac{\pi^3}{24}+\frac{\pi\log(2)}{2}$$ $\endgroup$
    – bob
    Commented Aug 12, 2023 at 16:23
  • 1
    $\begingroup$ This example isn't clarifying what you are really looking for, nevertheless you can use e.g. Expand[Int[2]] but I guess your expectatins might be different since various powers of Log[2] are also involved. $\endgroup$
    – Artes
    Commented Aug 12, 2023 at 16:32
  • 1
    $\begingroup$ Anyway you can also collect appropriately terms with Pi something like Collect[Int[7], Flatten@Prepend[{Pi}, Table[Zeta[2 k + 1], {k, 3}]], FullSimplify] $\endgroup$
    – Artes
    Commented Aug 12, 2023 at 16:40

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