|
SOLUTIONS
|
MATHEMATICA GUIDE
Rules & Patterns
At the core of Mathematica's symbolic programming paradigm is the concept of transformation rules for arbitrary symbolic patterns. Mathematica's pattern language conveniently describes a very general set of classes of expressions, making possible uniquely readable, elegant and efficient programs.
Featured ExamplesFeatured Examples |
-
Define a Function for Repeated Expressions
-
Dynamically Adjust the Parameters of a Differential Equation
-
Get the Number of Points Used to Plot a Curve
-
Implement the Bubble Sort Algorithm with Patterns and Rules
-
Implement the Heap Sort Algorithm with Patterns and Rules
-
Include Delay Differential Equations Directly in Dynamic Simulations
-
Remove Tags from Imported HTML
-
Successively Replace Entries in an Array
-
Use Rules Iteratively
-
Verify the Solution to an Equation
-
Visualize Solutions to Equations
-
Visualize the Lorenz Attractor
ReferenceReference
Rules »
lhs→rhs (Rule) — representation of replacement rule
expr/.rules (ReplaceAll) — apply replacement rules to an expression
RuleDelayed(:>) ▪ ReplaceRepeated(//.) ▪ Condition(/;) ▪ ...
Patterns »
x_ — any expression, named ![]()
x__ — sequence of expressions
a|b|c — alternative forms
Repeated(..) ▪ Except ▪ Longest ▪ Shortest ▪ ...
Pattern Matching Functions »
Cases — elements of a list or expression matching a given pattern
Position ▪ MemberQ ▪ MatchQ ▪ Count ▪ DeleteCases ▪ ...
Assignments »
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
