Mathematica 9 is now available

Position

Usage

Position[expr, pattern] gives a list of the positions at which objects matching pattern appear in expr.
Position[expr, pattern, levspec] finds only objects that appear on levels specified by levspec.
Position[expr, pattern, levspec, n] gives the positions of the first n objects found.


Notes

• Example: Position[ 1+x^2, 5, x^4 , x^_]LongRightArrow .
Position[expr, pattern] tests all the subparts of expr in turn to try and find ones that match pattern.
Position returns a list of positions in a form suitable for use in Extract, ReplacePart and MapAt. The form is different from the one used in Part.
• The default level specification for Position is {0, Infinity}, with Heads -> True.
• A part specification {} returned by Position represents the whole of expr.
Position[list, pattern, {1}, Heads -> False] finds positions only of objects that appear as complete elements of list.
• Level specifications are described in Section A.3.6.
• New in Version 1.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.