Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 want to use custom transformation functions in Simplify, but Mathematica does not seem to use them properly. Consider the following

t1[a] := 1
t2[b] := 0
FullSimplify[a + b, TransformationFunctions -> {t1, t2}]

As intended this evaluates to 1. However, if I add the standard transformation functions nothing happens:

FullSimplify[a + b, TransformationFunctions -> {Automatic, t1, t2}]

This gives a + b. Why did Mathematica forget about my custom functions? Ideas?

share|improve this question

Interesting question. I don't know if this behavior is intended but I think I can at least give some insight into the problem.

We can use a custom ComplexityFunction with an embedded Print to take a look at what transformed expressions are tested.

cf = (Print[#]; LeafCount[#] + Count[#, _Symbol, {0, -1}]) &;

We will also need to make use of ClearSystemCache[] to see all simplification attempts.

First without Automatic:

Simplify[a + b, TransformationFunctions -> {t1, t2}, ComplexityFunction -> cf]

Observe that for whatever reason t1 and t2 are not applied to atomic elements when Automatic is included:

Simplify[a + b, TransformationFunctions -> {Automatic, t1, t2}, ComplexityFunction -> cf]

While the cause is not clear the solution is: write your transformation functions so that they work on compound expressions.

For example:

t3 = # /. {a -> 1, b -> 0} &;

Simplify[a + b, TransformationFunctions -> {Automatic, t3}]
share|improve this answer

Your Answer


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

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