This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Algebraic Computation  /
ComplexityFunction

  • ComplexityFunction is an option for Simplify and FullSimplify which gives a function to rank the complexity of different forms of an expression.
  • 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.
  • Simplify[ expr , ComplexityFunction-> f ] applies f to each intermediate expression generated by Simplify, treating the one which yields the smallest numerical value as simplest.
  • See the Mathematica book: Section 3.3.9.
  • See also: Length, StringLength, TimeConstraint, ExcludedForms.

    Further Examples

    You can use the option ComplexityFunction to specify different simplicity criteria. Here the goal is to avoid Sin if possible.

    In[1]:=

    Out[1]=

    Here the goal is to minimize the number of leaves by absorbing the factors into the logarithms.

    In[2]:=

    Out[2]=

    Under the default ComplexityFunction, the last three entries in the list are left unchanged. They are considered simpler than the alternative forms seen in the previous example because the relatively large integers no longer appear.

    In[3]:=

    Out[3]=