# 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. – Anixx Apr 15 '12 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}. – Eli Lansey Apr 15 '12 at 17:31
I want FullSimplify to follow these rules. – Anixx Apr 15 '12 at 17:53
An example would be helpful, but what about FullSimplify[expr, TransformationFunctions -> {Gamma,HurwitzZeta}] – Eli Lansey Apr 15 '12 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. – Sjoerd C. de Vries Apr 15 '12 at 20:55

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. – T. Webster Sep 4 '12 at 6:29

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]

-

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? – celtschk Apr 15 '12 at 21:58
@celtschk LeafCount[] IS the default Complexity function – Dr. belisarius Apr 15 '12 at 22:17
What complexity is by default assigned to expressions that contain user's functions? Why user-defined functions always expanded to their definitions? Can it be avoided? – Anixx Apr 15 '12 at 23:06
@Anixx With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount, with corrections to treat integers with more digits as more complex. – Dr. belisarius Apr 15 '12 at 23:09
What complexity is assigned to user-defined functions? Why they are always expanded? – Anixx Apr 15 '12 at 23:11