0
$\begingroup$

Without assuming anything on the argument of the complex number inside the Gamma function

Assuming[{x ∈ Reals}, Simplify[Normal[Series[Gamma[a x + b], {x, ∞, 0}]]]]

produces

enter image description here

However, adding that the argument of the Gamma function can't be just a negative real number leads to

Assuming[{x ∈ Reals, Arg[a x + b] < π}, 
  Simplify[Normal[Series[Gamma[a x + b], {x, ∞, 0}]]]]

with result

0

What is going on here?

UPDATE Also I should probably mention that both DLMF and the Wolfram functions website suggest that the leading order term in this expansion should be

E^(-b - a*x)*Sqrt[2*Pi]*(b + a*x)^(-1/2 + b + a*x)

which is different than any of the answers that Mathematica gives.

$\endgroup$
  • 1
    $\begingroup$ Try {x, [Infinity], 1} instead of {x, [Infinity], 0} in your second code. $\endgroup$ – user64494 Apr 11 at 16:14
  • $\begingroup$ This would include higher order terms plus it produces a different answer by a factor of Sqrt[2\[Pi]]x^(-1/2+b). $\endgroup$ – ThunderBiggi Apr 11 at 17:24
  • $\begingroup$ What exactly are you trying to do here? What is the problem that you are trying to solve? $\endgroup$ – Somos Apr 11 at 18:46
  • $\begingroup$ @Somos I am not trying to solve any particular problem. I ask Mathematica to do some series and it gives me an answer that has two options depending on the assumptions on the variables involved. I then reattempt the calculation, providing one set of assumptions of those two that Mathematica gave me earlier and expect to get the answer corresponsing to that assumption, but I don't. There is certainly something going wrong here, right? $\endgroup$ – ThunderBiggi Apr 11 at 18:57
  • $\begingroup$ If what you state is the case, then you have discovered just one instance of where Mathematica does not produce results that you expected. It is not a bug but a feature. If you had a real problem to solve, then it would be a more serious situation. Yes, certainly, your assumptions about how Mathematica works are very likely to be wrong. Nothing wrong with that. $\endgroup$ – Somos Apr 11 at 19:02
2
$\begingroup$

Try this instead

ex = Assuming[{x \[Element] Reals, Arg[a x + b] < Pi}, 
  Simplify[Normal[Series[Gamma[a x + b]/Sqrt[2 Pi], {x, Infinity, 0}]]]];
ex // InputForm

which returns the result in version 10.2

(a^(-1/2 + b + a*x)*(x^(-1))^(1/2 - b - a*x))/E^(a*x)

but in the latest version returns

a^(-1/2 + b + a*x)*E^((1 - 6*b + 6*b^2 - 12*a^2*x^2)/(12*a*x))*x^(-1/2 + b + a*x)

Note that the answer has changed between versions so it is automatically suspect. Also note carefully that the real difference from your input here is that the Gamma[a x + b] is divided by Sqrt[2 Pi]. If that is removed, then the result is 0. This does not make sense mathematically, but it is probably an obscure bug. Thanks for noticing it.

However, if you use more terms for the Series[] then things get much stranger. The expression is Exp[] and the power series is in the exponential. What I mean is that the following code

ex = Assuming[{x \[Element] Reals, Arg[a x + b] < Pi}, Sqrt[2 Pi]
   Simplify[Normal[Series[Gamma[a x + b]/Sqrt[2 Pi], {x, Infinity, 2}]]]];
ex[[2]] // InputForm

in the latest version returns the result

E^(-(b + 2*b^3 + 6*a*b*x - 3*b^2*(1 + 2*a*x) + a*x*(-1 + 12*a^2*x^2))/(12*a^2*x^2))

but you get a different result if you don't multiply and divide by Sqrt[2 Pi]. Clearly, something strange is going on here.

My advice to you would be to use something like

ex = Assuming[{x \[Element] Reals},
   Simplify[Normal[Series[Gamma[x], {x, Infinity, 3}]]]] /. x -> a x + b;
ex // InputForm

which returns the result

(E^(-b - a*x)*Sqrt[Pi/2]*(b + a*x)^(-5/2 + b = a*x)*(1+ 24*(b + a*x) + 288*(b+ a*x)^2)/144
$\endgroup$
  • $\begingroup$ Which Mathematica version are you using, as I am with 11.3 and I get different things from you. Specifically, the first line of code you have shown returns a^(-1/2 + b + a*x)*E^((1 - 6*b + 6*b^2 - 12*a^2*x^2)/(12*a*x))*x^(-1/2 + b + a*x) for me. And the second one gives completely different stuff E^(-(1 - 30*b^4 - 30*a^2*x^2 + 360*a^4*x^4 + 60*b^3*(1 + a*x) + 30*a*b*x*(1 + 6*a*x) - 30*b^2*(1 + 3*a*x + 6*a^2*x^2))/(360*a^3*x^3)) $\endgroup$ – ThunderBiggi Apr 12 at 8:16
  • $\begingroup$ Also, check the update to my original post. $\endgroup$ – ThunderBiggi Apr 12 at 8:23
  • $\begingroup$ I agree with what you have suggested, with the exception that in this case you are implicitly assuming that a and b are real, by demanding that x in Gamma[x] is real and then doing a replacement after the series expansion. The amusing thing is that in this situation all the factors are correct, even the Sqrt[Pi/2]. So what is the conclusion from all this? There is a subtle bug going on here? How is this to be reported? $\endgroup$ – ThunderBiggi Apr 12 at 13:24
  • $\begingroup$ You have to distinguish between what is mathematically meaningul and what Mathematica outputs. Mathematica and all other computer programs do not understand mathematics. Hopefully, you do know mathematics and can judge the validity of the results produced and adjust accordingly. You can report this as strange and unexpected behavior. $\endgroup$ – Somos Apr 12 at 15:06
2
$\begingroup$

Do it this way it should be fine

Refine[Simplify[Normal[Series[Gamma[a x + b], {x, \[Infinity], 0}]]], 
 Assumptions -> {x \[Element] Reals}]


Refine[Simplify[Normal[Series[Gamma[a x + b], {x, \[Infinity], 0}]]], 
 Assumptions -> {x \[Element] Reals, Arg[a x + b] < \[Pi]}]

OUTPUT

enter image description here

$\endgroup$
  • $\begingroup$ So, does that mean that I should be using Refine from now on with Assumptions as an option? Also, check the update to my original post. $\endgroup$ – ThunderBiggi Apr 12 at 8:20
  • $\begingroup$ I don't think you even need the Refine: Simplify[Normal[Series[Gamma[a x + b], {x, [Infinity], 0}]], Assumptions -> {x [Element] Reals, Arg[a x + b] < [Pi]}] gives the expected answer. This suggests that the problem is with placing the Assumptions first, rather than later in the expression. $\endgroup$ – bill s Apr 12 at 12:45
  • $\begingroup$ I see. Shall this be reported somehow? $\endgroup$ – ThunderBiggi Apr 12 at 13:19

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.