Read Online
Download PDF
Additional resources
Revision history
Known typos/bugs
Report a bug
License terms
About the author
"node79_1.gif" "node79_2.gif" "node79_3.gif"

1.1.7     Levels of expressions and the Level command

It is  also possible to get access to the branches (subexpressions) which are at the   certain distance (level) from the "stem". This is achieved by using a built-in Level command. Consider an example:



Here is its full form :



Here is its tree form :



And these are the levels of the tree :







Level[a, {n}] gives all branches (or leaves) which have a distance of n levels down from the "stem". If however we need all branches that have n levels of sub - branches (or leaves), then we use a negative level Level[a, {-n}] :






Notice that negative levels  generally can not be reduced to positive levels - they are giving in general different types of information. What we have just described is called the Standard Level Specification in Mathematica. Many more built - in commands accept level specification as one of the arguments (often an optional one).

Any function can be used also in its literal equivalent form. For instance :



"node79_23.gif" "node79_24.gif" "node79_25.gif"

Created by Wolfram Mathematica 6.0  (05 February 2009) Valid XHTML 1.1!