Skip to main content
1 of 3
Max1
  • 1.1k
  • 5
  • 10

Abstract:

In addition to other answers I'd like to give a more analytically centered approach. I'll show that for $\operatorname{Re}(x')>0.$ it holds that $-(\psi^{(1)}(x'+n)-\psi^{(1)}(x'))=\sum_{i=1}^{n}\frac{1}{(i-1+x')^2}$. With that we can show why mathematica is "generically right" but wrong in the specific case considered here.

Proof:

According to wikipedia it holds that

$$ -[\psi(x'+n)-\psi(x')]=-\sum_{i=0}^{n-1}\frac{1}{i+x'} $$

for $\operatorname{Re}(x')>0$. If we now take the derivative of left and right hand side, we obtain the polygamma functions found in the mathemtica expression on the left hand side.

$$ -[\psi^{(1)}(x'+n)-\psi^{(1)}(x')]=\sum_{i=0}^{n-1}\frac{1}{(i+x')^2} $$

For convenience we shift the expression on the right hand side a little and obtain the desired result.

$$ -[\psi^{(1)}(x'+n)-\psi^{(1)}(x')]=\sum_{i=1}^{n}\frac{1}{(i-1+x')^2} $$

Applying the result to the specific case

We set $x'=(1-2n)$ in the upper formula. This clearly violates the premise, because x' will be negative. However, we will proceed by evaluating the expressions formally to explain mathematicas result.

$$ \begin{split} -[\psi^{(1)}((1-n)-\psi^{(1)}(1-2n)]&=\psi^{(1)}(1-2n)-\psi^{(1)}((1-n)\\ &=\sum_{i=1}^{n}\frac{1}{(i-1+(1-2n))^2} \end{split} $$

The left hand side equals mathematica Polygammes[1,1-2n]-Polygamma[1,1-n] and the denominator of the sum equals (i + (n - i) x)^2 /. x -> 2. This can be checked with

(i - 1 + (1 - 2 n))^2 == (i + (n - i)*x)^2 /. x -> 2 // FullSimplify

which gives True.

To stress my point again $x'=-1+(1-2 n)$ is negative for any $n\geq0$. Since mathematica cannot know what x is going to be in advance I assume that it just uses some generic transformations, which do not apply in all cases and especially not in this case.

Max1
  • 1.1k
  • 5
  • 10