Replacing gamma at half integers by double factorial
You could use a function to do this expansion for you:
ClearAll[gammaExpand]
gammaExpand[e_] := e /. (Gamma[n_ + 1/2 /; FullSimplify[n ∈ Integers && n > 0]] :>
Sqrt[π] (2 n - 1)!!/2^n)
The FullSimplify
in the definition takes care of picking up any assumptions placed in surrounding Assumptions
blocks or assignments to $Assumptions
.
expr = Sin[Log[Gamma[1/2 + n]]];
This doesn't expand (as it should):
gammaExpand@expr
Sin[Log[Gamma[1/2 + n]]]
This does:
Assuming[n ∈ Integers && n > 0, gammaExpand@expr]
Sin[Log[2^-n Sqrt[π] (-1 + 2 n)!!]]
It would be nice if you could build this rule into FullSimplify
itself. It has the option TransformationFunctions
for that. However, there is a reason that this doesn't work:
FullSimplify[expr,
Assumptions -> n ∈ Integers && n > 0,
TransformationFunctions -> {Automatic, gammaExpand}
]
Sin[Log[Gamma[1/2 + n]]]
The reason is that the resulting expression is simply more complex than the original, so FullSimplify
doesn't have an incentive to perform this step. In fact, whenever it sees anything like the expanded form it will try to reduce it:
FullSimplify[2^-n Sqrt[π] (-1 + 2 n)!!,
Assumptions -> n ∈ Integers && n > 0]
Gamma[1/2 + n]
You could try to come up with a modified version of the default ComplexityFunction
but that would probably be too much hassle for this simple goal. Easier would be to forbid the reducing transformation using ExcludedForms
:
Assuming[n ∈ Integers && n > 0,
FullSimplify[expr // gammaExpand,
ExcludedForms -> {Sqrt[π] (2 n_ - 1)!!/2^n_}
]
]
Sin[Log[2^-n Sqrt[π] (-1 + 2 n)!!]]