I'd like to convert expressions such as
Gamma[(1/10)*(13 + 10*n)]
to
Gamma[13/10 + n]
I tried the rule
Gamma[r_] -> Gamma[Expand[r]]
but that doesn't seem to work.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityThere's also ExpandAll
:
ExpandAll[Gamma[(1/10)*(13 + 10*n)]]
(* Gamma[13/10 + n] *)
You need to use a delayed version of the rule
Gamma[r_]:>Gamma[Expand[r]]
rather than
Gamma[r_]->Gamma[Expand[r]]
otherwise the Expand
is applied to r
(returning simply r
) before the substitution is attempted.
A slightly briefer alternative is
r_Gamma :> Expand/@r
This matches any expression that has Head
Gamma
and has the added effect of matching multiple argument versions of Gamma
and expanding each of their arguments independently.
:>
instead of->
. Alternatively just useExpandAll
on the complete expression. $\endgroup$FunctionExpand@ Gamma[(1/10)*(13 + 10*n)]
$\endgroup$