4
$\begingroup$

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.

$\endgroup$
4
  • 2
    $\begingroup$ You want :> instead of ->. Alternatively just use ExpandAll on the complete expression. $\endgroup$ Aug 23, 2016 at 16:00
  • $\begingroup$ FullSimplify@Gamma[(1/10)*(13 + 10*n)] works as well. $\endgroup$
    – bill s
    Aug 23, 2016 at 20:05
  • $\begingroup$ An alternative is to use FunctionExpand@ Gamma[(1/10)*(13 + 10*n)] $\endgroup$
    – user31159
    Oct 22, 2016 at 22:42
  • $\begingroup$ ExpandAll also works. $\endgroup$
    – Wen Chern
    Oct 23, 2016 at 8:31

2 Answers 2

3
$\begingroup$

There's also ExpandAll:

ExpandAll[Gamma[(1/10)*(13 + 10*n)]]
(*  Gamma[13/10 + n]  *)
$\endgroup$
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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