3
$\begingroup$

Could anybody explain why Mathematica gives different results with:

With[{n = 6, z = 0.34}, 
  { Integrate[ Log[ Gamma[t + n]/Gamma[t]], t] /. t -> z, 
    Integrate[ Log[ Pochhammer[t, n]], t] /. t -> z}] 
{9.83259, 19.319} 

recalling that by definition Gamma[t + n]/Gamma[t] == Pochhammer[t, n]?

The same issue for different values of $n$ and $z$.

$\endgroup$
  • $\begingroup$ Hi Nasser! I cleaned up the formatting of your question. Check out mathematica.stackexchange.com/editing-help for more info on formatting. I personally like to put code in a block delimited by ```. $\endgroup$ – Chris K Apr 5 at 2:19
  • $\begingroup$ Added the [scoping] tag, because without With it's evaluating correctly for both expressions. $\endgroup$ – m0nhawk Apr 5 at 2:20
  • $\begingroup$ @m0nhawk, what do you mean by "evaluating correctly for both expressions"? $\endgroup$ – Alx Apr 5 at 2:24
  • 5
    $\begingroup$ Indefinite integrals are anti-derivatives, they can differ by an arbitrary constant and still both be valid anti-derivatives. Compare with With[{n = 6, z = 0.34`15}, {Integrate[Log[Gamma[t + n]/Gamma[t]], {t, 0, z}], Integrate[Log[Pochhammer[t, n]], {t, 0, z}]}] $\endgroup$ – Bob Hanlon Apr 5 at 2:37
  • 1
    $\begingroup$ @m0nhawk I'm not sure With is to blame, I see the same discrepancy with n = 6; z = 0.34; Integrate[Log[Gamma[t + n]/Gamma[t]], t] /. t -> z Integrate[Log[Pochhammer[t, n]], t] /. t -> z $\endgroup$ – Chris K Apr 5 at 2:46
6
$\begingroup$

Calculating indefinite integrals we can expect different expressions, at least different by a constant. It is not surprising since the expressions in logarithms migth be negative and so issues with different branches of logarithm would appear. Let's calculate indefinite integrals:

 ints = With[{ n = 6}, Assuming[ t > 0, 
                         { Integrate[ Log[ Gamma[t + n]/Gamma[t]], t],

                           Integrate[ Log[ Pochhammer[t,n]], t]}]]
 { t Log[Gamma[6 + t]/Gamma[t]] + t LogGamma[t] - t LogGamma[6 + t] - PolyGamma[-2, t] 
   + PolyGamma[-2, 6 + t],

  -6 t + Log[1 + t] + 2 Log[2 + t] + 3 Log[3 + t] + 4 Log[4 + t] + 5 Log[5 + t] 
   + t Log[t (1 + t) (2 + t) (3 + t) (4 + t) (5 + t)]}

We use a rational counterpart of approximate number 0.34 to find the difference in an exact form:

 FullSimplify[ ints[[1]] - ints[[2]], t == 17/50]
 3 (-5 + Log[2] + Log[Pi])

It appears that the both expressions differ by the above number which equals to

N @ %
 -9.48637 

as in the question. This difference is the same for every argument as one could expect.

Plot[ ints, {t, 0, 2}, Evaluated -> True, PlotStyle -> Thick, AxesOrigin -> {0, 0}]

enter image description here

Of course definite integrals calculated in appropriate ranges don't differ.

ints2 = With[{n = 6, z = 17/50}, 
             { Integrate[ Log[ Gamma[t + n]/Gamma[t]], {t, 0, z}], 
               Integrate[ Log[ Pochhammer[t, n]], {t, 0, z}]}];

 ints2[[1]] == ints2[[2]]
True

It should be noted that symbolically the both integrals can take different forms, e.g. consider the integrands without logarithms:

With[{ n = 6}, Assuming[ z > 0,{ Integrate[ Gamma[t + n]/Gamma[t], {t,0,z}],
                                 Integrate[ Pochhammer[t,n], {t,0,z}]}]]
{ Integrate[ Gamma[6 + t]/Gamma[t], {t, 0, z}], 
  60 z^2 + (274 z^3)/3 + (225 z^4)/4 + 17 z^5 + (5 z^6)/2 + z^7/7}

although the system knows that the integrands are equal:

FullSimplify[ Gamma[t + n]/Gamma[t] == Pochhammer[t, n]]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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