Tagged Questions
5
votes
1answer
65 views
Why does this pattern for combining two lists require triple underscores (___) to work?
I understand that __ is a list of one or more elements, and that ___ is 0 or more elements, but when I try this rule with 2 ...
18
votes
1answer
213 views
replacement rules from a pattern and a matching expression
(This seems to be a very basic necessity in a language having pattern-matching capabilities such as Mathematica, yet I struggled for many hours to find a common solution to this problem.)
Suppose ...
8
votes
2answers
113 views
Replacing product expressions - named vs. unnamed pattern?
Suppose I have an expression of the form
a b c d + x y z
The FullForm of this is
...
7
votes
1answer
160 views
Is it possible to specify a context-sensitive, “depth-agnostic” rewrite rule?
I'm using the term "depth-agnostic" in this post to describe structural patterns featuring a "target" sub-pattern that can occur "at any depth" relative to one or more "context" sub-patterns.
As a ...
7
votes
2answers
189 views
Why does the name of a pattern affect the result of a transformation rule?
I was playing a little dirty, trying to get a template for defining a Curl[] operator.
I wrote the following rule, which I knew was going to spit out a few ...
1
vote
2answers
118 views
Using patterns in ReplaceAll to extract elements from tuples at arbitrary depths
Please consider the following:
I need to extract from MyList all last parts of each 3-tuple.
...
3
votes
1answer
103 views
Pattern matching a multivariate derivative
I can extract the parameters of a single variable derivative with the rule
D[f[x], x] /. Derivative[order_][fcn_][variable_] ->
{order, fcn, variable}
...
3
votes
1answer
108 views
Set promotes Rule to RuleDelayed?
In mentally building a model of how Mathematica works, I naively expected Set to create a Rule in a symbol's ...
8
votes
2answers
452 views
Mathematica rule substitution memory
First I present the specific programming question, and then I provide further background details.
Given an expression in Mathematica, say f=3x+7y, there are two ...
6
votes
3answers
234 views
Replacement rule only matches part of expression
I have the result of a calculation (which is too long to mention here) and it gives
...