2
$\begingroup$
Clear["Global`*"];

f[x_] := (Cos[x]^(2 n))

int=Assuming[Element[n,PositiveIntegers], Integrate[f[x], {x, 0, 2*Pi}]]

(*(2 Sqrt[\[Pi]] Gamma[1/2 + n])/Gamma[1 + n]*)

I tried:

Developer`GammaSimplify@int

(*(2 Sqrt[\[Pi]] Gamma[1/2 + n])/Gamma[1 + n]*)

Simplify`SimplifyGamma@int

(*(2 Sqrt[\[Pi]] Gamma[1/2 + n])/Gamma[1 + n]*)

I want to get Factorial instead of Gamma. As commented by @Michael E2, it should be a double factorial, Factorial2:

$\frac{2 \pi(2 n-1) ! !}{(2 n) ! !}$

I think the key point is that I cannot expand Gamma[1/2+n] into Factorial using the MMA function or code.

Related:

Show Factorial instead of Gamma in the result of RSolve

How can I get the simplest result of this sum?

$\endgroup$
5
  • 4
    $\begingroup$ If $n$ is a positive integer, then you could use the rule Gamma[n_ + 1/2] -> 2^-n Sqrt[\[Pi]] (-1 + 2 n)!!. $\endgroup$
    – JimB
    Aug 27, 2023 at 15:25
  • 3
    $\begingroup$ If you merely want to get only factorials, use the rule Gamma[z_] :> (z - 1)! $\endgroup$
    – Bob Hanlon
    Aug 27, 2023 at 16:05
  • 1
    $\begingroup$ You call it Factorial but you show a double factorial ($(2n)!!$ = Factorial2[2n]). Which do you mean? $\endgroup$
    – Michael E2
    Aug 27, 2023 at 19:46
  • $\begingroup$ Great. Thank you all! $\endgroup$
    – lotus2019
    Aug 27, 2023 at 23:23
  • $\begingroup$ @Michael E2 You're right. Thank you for telling me that there is a Factorial2 function. $\endgroup$
    – lotus2019
    Aug 27, 2023 at 23:26

2 Answers 2

5
$\begingroup$
int = (2 Sqrt[π] Gamma[1/2 + n])/Gamma[1 + n];

Assuming[n >= 0 && Element[n, Integers],
  int /. Gamma[t_] -> 2^(1-t) (π/2)^((1-Cos[2π(t-1)])/4) (2(t-1))!! //FullSimplify]

(*    (2 π (-1 + 2 n)!!)/(2 n)!!    *)

How did I get this formula? Just invert this output:

u!! // FunctionExpand
(*    2^(u/2 + 1/4 (1 - Cos[π u])) π^(1/4 (-1 + Cos[π u])) Gamma[1 + u/2]    *)

update

For a bit more automated judging of simplifications, we can define custom transformation functions for FullSimplify:

fac[z_] := z /. Gamma[t_] :> (t - 1)!
fac2[z_] := z /. Gamma[t_] :> FullSimplify[2^(1-t)*(π/2)^((1-Cos[2π(t-1)])/4)] (2(t-1))!!

Assuming[n >= 0 && Element[n, Integers],
  FullSimplify[int, TransformationFunctions -> {Automatic, fac, fac2}]]

(*    (2 π (-1 + 2 n)!!)/(2 n)!!    *)
$\endgroup$
1
  • $\begingroup$ A great answer. Especially, update solves the problem of converting Gamma to Factorial (Factorial2). Thank you! $\endgroup$
    – lotus2019
    Aug 27, 2023 at 23:48
0
$\begingroup$
FullSimplify[(2 Sqrt[\[Pi]] Gamma[1/2 + n])/
  Gamma[1 + n], {n \[Element] Integers, n > 0}]
  
(*  (2 Sqrt[\[Pi]] Gamma[1/2 + n])/n!  *)

??

$\endgroup$
2
  • 2
    $\begingroup$ ?? There is still a Gamma function in your result. $\endgroup$
    – lotus2019
    Aug 27, 2023 at 15:20
  • 1
    $\begingroup$ Well, better than nothing. $\endgroup$ Aug 27, 2023 at 17:05

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.