Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been playing with various equations involving amount of permutations in relatively large sets. Easiest way to look at these is something like Log[10, bignumber!] . Often expressions, even indirect ones like Sum[Log[2,x], {x,1,2^32}] expand to forms involving Log[Gamma[...]] . This is problematic, since Gamma quickly grows past machine-representable numbers. OTOH, Mathematica knows this (for non-negative reals):

FullSimplify[Log[Gamma[x]] == LogGamma[x], x > 0]

(* True *)

It also knows that LogGamma can be split to Log[Gamma[...]]:

FullSimplify[LogGamma[x], x > 0, 
 ComplexityFunction -> (2 Count[#, _LogGamma, {0, Infinity}] + 
     LeafCount[#] &)]

(* Log[Gamma[x]] *)

... but for what I really want, the reverse, it's not particularly forthcoming:

FullSimplify[Log[Gamma[x]], x > 0, 
 ComplexityFunction -> (1000 Count[#, _Gamma, {0, Infinity}] + 
     LeafCount[#] &)]

(* Log[Gamma[x]] *)

Yes, I know that I can do the transformation with rather trivial rule myself. Yet, I'm left to wonder a) why this transformation doesn't occur automatically even with above vigorous hint, b) is there an actual, good reason for the observed behaviour, and c) is there a non-manual way around it. I can only guess that similar condition applies to many other forms, too.

share|improve this question
Because LogGamma[] simplifies to Log[Gamma[]] (use FunctionExpand), you can't (automatically) have it both ways! One of them has to be considered "simpler" than the other in order for the simplification to terminate. – whuber Oct 24 '12 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.