ReplaceRepeated
ReplaceRepeated(expr, lhs -> rhs)
expr //. lhs -> rhs
or
ReplaceRepeated(expr, lhs :> rhs)
expr //. lhs :> rhs
repeatedly applies the rule
lhs -> rhs
toexpr
until the result no longer changes.
Examples
>> a+b+c //. c->da+b+d
Simplification of logarithms:
>> logrules = {Log(x_ * y_) :> Log(x) + Log(y), Log(x_^y_) :> y * Log(x)};
>> Log(a * (b * c) ^ d ^ e * f) //. logrulesLog(a)+d^e*(Log(b)+Log(c))+Log(f)
ReplaceAll
just performs a single replacement:
>> Log(a * (b * c) ^ d ^ e * f) /. logrulesLog(a)+Log((b*c)^d^e*f)
Related terms
Dispatch, Replace, ReplaceAll, ReplaceList, ReplacePart
Implementation status
- ✅ - full supported