SolveTools
Complexity
compute the (relative) complexity of an expression
Calling Sequence
Parameters
Description
Examples
Complexity(expr, vars)
expr
-
expression
vars
(optional) set; variables with respect to which the complexity is computed
The Complexity command computes the complexity of the expression expr with respect to the set of variables vars.
A number that reflects the relative complexity of the expression is returned.
The Complexity command has two modes. If Complexity is called with one argument, the 'Polynomial' mode is used. If it is called with two arguments, the 'Rational' mode is used.
The 'Rational' mode takes into account the variables that are used in the expression, whereas the 'Polynomial' mode treats all the variables equally.
The two modes are independent and the complexity of the expression in one mode gives no indication of the complexity of the same expression in the other mode. The values of the complexities bear no absolute value in either mode; they serve only as the indication of relative complexities of different expressions in the same modes.
This function is part of the SolveTools package, and so it can be used in the form Complexity(..) only after executing the command with(SolveTools). However, it can always be accessed through the long form of the command by using SolveTools[Complexity](..).
with⁡SolveTools:
The following are some relative polynomial complexities.
Complexity⁡2⁢x
665
Complexity⁡3⁢x
13310
Complexity⁡x+y
34110
Complexity⁡x+2⁢y
1715
Complexity⁡x+exp⁡y
609110
The following are some relative rational complexities.
Complexity⁡2⁢x,x
4000
Complexity⁡3⁢x,x
9000
Complexity⁡x+y,x
1001
Complexity⁡x+2⁢y,x
1004
Complexity⁡x+exp⁡y,x,y
2000
The following examples are equally complicated with respect to x from rational point of view.
Complexity⁡x+exp⁡y,x
Complexity⁡x+exp⁡z⁢y,x
However, they are different from polynomial point of view.
Complexity⁡x+exp⁡z⁢y
1121110
See Also
SolveTools[GreaterComplexity]
SolveTools[SortByComplexity]
Download Help Document