Mathematica 9 is now available

RuleDelayed (:>)ReplaceAll (/.)

Replace

FilledSmallSquareReplace[expr, rules] applies a rule or list of rules in an attempt to transform the entire expression expr.

FilledSmallSquareReplace[expr, rules, levelspec] applies rules to parts of expr specified by levelspec.

FilledSmallSquare Examples: Replace[x^2, x^2 -> a] LongRightArrow.

FilledSmallSquareReplace[x + 1, x -> a] LongRightArrow.

FilledSmallSquare The rules must be of the form lhs -> rhs or lhs :> rhs.

FilledSmallSquare A list of rules can be given. The rules are tried in order. The result of the first one that applies is returned. If none of the rules apply, the original expr is returned.

FilledSmallSquare If the rules are given in nested lists, Replace is effectively mapped onto the inner lists. Thus Replace[expr, , , , ... , ... ] is equivalent to Replace[expr, , ], Replace[expr, , ... ], ... .

FilledSmallSquare Delayed rules defined with :> can contain /; conditions.

FilledSmallSquare Level specifications are described in Section A.3.6.

FilledSmallSquare The default value for levelspec in Replace is {0}.

FilledSmallSquare Replacements are performed to parts specified by levelspec even when those parts have Hold or related wrappers.

FilledSmallSquareReplace takes a Heads option, with default setting Heads -> False.

FilledSmallSquare See The Mathematica Book: Section 2.4.1.

FilledSmallSquare See also: Rule, Set, ReplacePart, ReplaceList, StringReplace, PolynomialReduce.

Further Examples

RuleDelayed (:>)ReplaceAll (/.)



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.