# How can I completely ban usage of some functions in output and mandate use of others?

For example, I hate that Mathematica uses Pochhammer symbol in outputs and prefer all the expressions in Gamma function. How can I ban usage of Pochhammer? I also want all outputs to use HurwitzZeta rather than Zeta.

In another instance I want the results to use my own variant of Polygamma function (modified). How can I mandate its usage when possible?

• I cannot give an exact example right now, but I think it quite ofthen appears. I am looking for a general solution that would work everywhere. Apr 15, 2012 at 16:56
• There might be a way to set this as the default, but I think that FunctionExpand[ expr ] can take the argument TargetFunctions->{Gamma,HurwitzZeta}. Apr 15, 2012 at 17:31
• I want FullSimplify to follow these rules. Apr 15, 2012 at 17:53
• An example would be helpful, but what about FullSimplify[expr, TransformationFunctions -> {Gamma,HurwitzZeta}] Apr 15, 2012 at 18:18
• @EliLansey I think that's ComplexExpand not FunctionExpand (having TargetFunctions option). And there it can only take {Re,Im,Abs,Arg,Conjugate,Sign} as values. Apr 15, 2012 at 20:55

You may try for example something like:

f[e_] := 100 Count[e, _Pochhammer, {0, Infinity}] + LeafCount[e];
FullSimplify[Pochhammer[k, n], ComplexityFunction -> f]

(*
->Gamma[k + n]/Gamma[k]
*)

• Does Mathematica provide access to the default complexity function, so you can just amend it instead of completely replacing? Apr 15, 2012 at 21:58
• @celtschk LeafCount[] IS the default Complexity function Apr 15, 2012 at 22:17
• @celtschk: not quite true that LeafCount is the default complexity function. As the docs ref/ComplexityFunction say, "forms are ranked primarily according to their LeafCount, with corrections to treat integers with more digits as more complex." Apr 16, 2012 at 0:21
• @Anixx by user defined 'functions' do you mean things like f[x_]:=Pochammer[x+1]? If so, then the reason is that MMA replaces any instance of f[x] with the RHS (it is actually not a Function), BEFORE any simplification is done (unless holds are in place), and hence doesn't know about simplification rules for it (see mathematica.stackexchange.com/questions/704/…). As to creating those rules: no idea Apr 16, 2012 at 11:19
• @celtschk, the default complexity function can be found in the Properties & Relations section of the ComplexityFunction documentation. Sep 4, 2012 at 8:04

Perhaps you will find utility in Format and related functions?

Unprotect[Pochhammer];

Format[Pochhammer[k_, n_]] := HoldForm[ Gamma[k + n]/Gamma[k] ]

Protect[Pochhammer];

Pochhammer[a, b]

Gamma[a + b]/Gamma[a]


Similar things can be done with $PrePrint: $PrePrint = # /. Pochhammer[k_, n_] :> HoldForm[ Gamma[k + n]/Gamma[k] ] &;

Pochhammer[a, b]

Gamma[a + b]/Gamma[a]


I have found ReplaceAll to be useful for when I want to replace instances of Gamma or Binomial calls to show as a factorial.

    x*Gamma[a] + x^2*Gamma[b] -
3*Binomial[z, c] /. {Gamma[n_] -> (n - 1)!,
Binomial[n_, k_] -> ((n)!/((n - k)!*k!))}


Out:

   x (-1 + a)! + x^2 (-1 + b)! - (3 z!)/(c! (-c + z)!)

• but note that it's up to you to know that the replacement is equivalent. Sep 4, 2012 at 6:29