1
$\begingroup$

For instance, PolyGamma function in Mathematica gives different values than the similar Psi function in Maple, which uses the formula by Espinosa and Moll.

The Mathematica documentation does not give a formula, just says that "For arbitrary complex n, the polygamma function is defined by fractional calculus analytic continuation".

I wonder, what exactly formula does Mathematica use? "We use fractional calculus analytic continuation" is too vague.

$\endgroup$
7
  • 2
    $\begingroup$ Comparing with the maple link you provided all examples (1)-(11) agree with the PolyGamma in Mathematica. In light of this, can you, please, make an effort to explain yourself better? What exactly is your issue? $\endgroup$
    – bmf
    Commented Dec 24, 2023 at 2:53
  • 1
    $\begingroup$ @Anixx in the way you have phrased your question does not make any sense. This is what I pointed out. It's too vague and the examples from the link you attached in the OP all agree between Mathematica and Maple. Try to be more concrete perhaps $\endgroup$
    – bmf
    Commented Dec 24, 2023 at 3:40
  • 1
    $\begingroup$ @bmf .With Mathematica I Have: $\psi ^{\left(\frac{1}{2}\right)}(1)\approx 0.481365$, in Maple: $\Psi^{\left(\frac{1}{2}\right)}\! \left(1\right)\approx 0.6570016629$ ? $\endgroup$ Commented Dec 24, 2023 at 11:09
  • 2
    $\begingroup$ @MariuszIwaniuk I think that my previous comments were clear. I am not saying that there is no discrepancy. I am saying that the question is very poorly phrased and all examples in the link from (1) to (11) are the same in both cases. That's the statement I made and I still think that the question should be edited to be made clear. And also, I am not implying that your example is not valid. I am saying that I don't see it included anywhere in the OP $\endgroup$
    – bmf
    Commented Dec 24, 2023 at 11:36
  • 2
    $\begingroup$ @Anixx details that are completely missing from the OP STILL. Am I not phrasing myself clearly enough? I am not against the question itself. I think it's written very poorly. $\endgroup$
    – bmf
    Commented Dec 24, 2023 at 11:51

1 Answer 1

5
$\begingroup$

For negative integer and negative noninteger Mathematica uses formula:

$$\psi ^{(n)}(x)=\frac{\int_0^x (x-t)^{-n-2} \text{log$\Gamma $}(t) \, dt}{(-n-2)!}$$

 PolyGammaMathematica[n_, x_] := 1/(-n - 2)!*NIntegrate[(x - t)^(-n - 2)*LogGamma[t], {t, 0, x}]
 PolyGammaMaple1[n_, x_] :=(HurwitzZeta[1 + n, x]*(EulerGamma + PolyGamma[0, -n]) + Derivative[1, 0][HurwitzZeta][1 + n, x])/Gamma[-n] // N
 PolyGammaMaple2[n_, x_] := -NIntegrate[(Exp[-x t]*t^n)/(1 - Exp[-t])*(Cos[Pi n] + EulerGamma/Pi*Sin[Pi n] + Sin[Pi n]/Pi*Log[t]), {t, 0, Infinity}](*For Re[x]>0,Re[n]>0*)

 Table[{PolyGammaMathematica[n, 1], PolyGamma[n, 1], 
 PolyGammaMaple1[n, 1]}, {n, -4, -1, 1/2}] // N // Chop // MatrixForm (*For negative integer and negative noninteger*)
 Table[{PolyGamma[n, 1], PolyGammaMaple2[n, 1]}, {n, 1, 4, 1/2}] // N //
  Chop // MatrixForm (*For positive integer and positive noninteger*)

EDIT 25.12.2023

Looks like unfortunately, multiple extensions of the polygamma function exist, that way Mathematica and Maple uses a different choice.

Formula for complexes fractional order:

$$\psi ^{(n)}(x)=x^{-n} \left(\frac{\gamma -\log (x)+\psi (-n)}{x \Gamma (-n)}-\frac{\gamma }{\Gamma (1-n)}\right)+x^{1-n} \sum _{k=1}^{\infty } \frac{\, _2\tilde{F}_1\left(1,2;2-n;-\frac{x}{k}\right)}{k^2}$$

 PolyGammaMathematica2[n_,x_] := x^-n*((EulerGamma - Log[x] + 
 PolyGamma[-n])/(x Gamma[-n]) - EulerGamma/Gamma[1 - n]) + 
 x^(1 - n)*NSum[1/k^2*Hypergeometric2F1Regularized[1, 2, 2 - n, - 
 x/k], {k, 1, Infinity}](*For integer n gives "Indeterminate expression"*)

 Table[{PolyGammaMathematica2[n, 1], PolyGamma[n, 1]}, {n, -3, 5, 
  1/3}] // N // Chop // MatrixForm // Quiet

 Table[{PolyGammaMathematica2[n, 1], PolyGamma[n, 1]}, {n, 1/2 + I, 
  5 + I, 1/2}] // N // Chop // MatrixForm // Quiet

For more info See here

$\endgroup$
1
  • $\begingroup$ @Anixx ,I updated my answer. $\endgroup$ Commented Dec 25, 2023 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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