"logo.gif"  
Main
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:

"node79_4.gif"

"node79_5.gif"

Here is its full form :

"node79_6.gif"

"node79_7.gif"

Here is its tree form :

"node79_8.gif"

"node79_9.gif"

And these are the levels of the tree :

"node79_10.gif"

"node79_11.gif"

"node79_12.gif"

"node79_13.gif"

"node79_14.gif"

"node79_15.gif"

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}] :

"node79_16.gif"

"node79_17.gif"

"node79_18.gif"

"node79_19.gif"

"node79_20.gif"

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_21.gif"

"node79_22.gif"

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

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