ReplaceRepeated
ReplaceRepeated(expr, lhs -> rhs)
expr //. lhs -> rhsor
ReplaceRepeated(expr, lhs :> rhs)
expr //. lhs :> rhsrepeatedly applies the rule
lhs -> rhstoexpruntil the result no longer changes.
Examples
>> a+b+c //. c->da+b+dSimplification 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