Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Formula Manipulation > Algebraic Transformations > ComplexityFunction >

ComplexityFunction

ComplexityFunction
is an option for Simplify and other functions 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 applies f to each intermediate expression generated by Simplify, treating the one which yields the smallest numerical value as simplest.
The default ComplexityFunction counts the subexpressions and digits of integers:
LeafCount counts only the number of subexpressions:
By default this expression is not simplified:
This complexity function makes ChebyshevT more expensive than other functions:
The default ComplexityFunction counts the subexpressions and digits of integers:
In[1]:=
Click for copyable input
Out[1]=
LeafCount counts only the number of subexpressions:
In[2]:=
Click for copyable input
Out[2]=
 
By default this expression is not simplified:
In[1]:=
Click for copyable input
Out[1]=
This complexity function makes ChebyshevT more expensive than other functions:
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
With the default ComplexityFunction, Abs[x] is simpler than the FullForm of -x:
This complexity function counts characters in the InputForm of the expression:
Now -x is simpler than Abs[x]:
The automatic complexity function:
New in 3
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF