PRODUCTS
Mathematica
Mathematica Home Edition
Mathematica for Students
Mathematica for the Classroom
grid
Mathematica
Wolfram Lightweight Grid Manager
web
Mathematica
Mathematica Player
(free download)
Mathematica Player Pro
Wolfram
Workbench
Mathematica
Applications
SOLUTIONS
Industry
Chemical Engineering
Image Processing
Mechanical Engineering
Petroleum Engineering
Environmental Sciences
Bioinformatics
Data Analysis and Mining
Financial Risk Management
Statistics
Software Engineering
More...
Education
Higher Education
Precollege Education
Students
Technology
Interactive Deployment
High-Performance and Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
FOR USERS
All User Resources
Product Registration
Technical Support
Customer Service
Developer Support
Does My Site Have a License?
Free Seminars
Learning Center
Training
Custom Group Seminars
Documentation & Examples
Tutorial Screencasts
Video Gallery
Demonstrations Project
Education Portal
Student Resources
COMPANY
About Wolfram Research
News & Events
Wolfram Blog
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
Wolfram|Alpha
Demonstrations Project
Wolfram Blog
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Library Archive
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
Mathematica
>
Core Language
>
Rules & Patterns
>
Rules
>
Built-in
Mathematica
Symbol
Applying Transformation Rules
Tutorials »
|
Replace
ReplaceAll
Rule
Set
FixedPoint
See Also »
|
Looping Constructs
Rules
Rules & Patterns
More About »
ReplaceRepeated
(//.)
expr
//.
rules
repeatedly performs replacements until
expr
no longer changes.
MORE INFORMATION
expr
//.
rules
effectively applies
/.
repeatedly, until the results it gets no longer change.
It performs one complete pass over the expression using
/.
, then carries out the next pass.
You should be very careful to avoid infinite loops when you use the
//.
operator. The command
x//.x->x+1
will, for example, lead to an infinite loop.
ReplaceRepeated
takes the option
MaxIterations
, which specifies the maximum number of times it will try to apply the rules you give. The default setting is
MaxIterations
->65536
. With
MaxIterations
->
Infinity
there is no limit.
EXAMPLES
CLOSE ALL
Basic Examples
(1)
Apply rules for the power and product laws for logarithms of real numbers recursively:
In[1]:=
In[2]:=
Out[2]=
ReplaceAll
does just a single replacement:
In[3]:=
Out[3]=
Applications
(1)
SEE ALSO
Replace
ReplaceAll
Rule
Set
FixedPoint
TUTORIALS
Applying Transformation Rules
MORE ABOUT
Looping Constructs
Rules
Rules & Patterns
RELATED LINKS
NKS|Online
(
A New Kind of Science
)
New in 1