Questions tagged [rule]
Questions about transformation rules in Mathematica--constructs that let you set, or programmatically modify, local values for expressions.
368 questions
1 vote
1 answer
102 views
Why is rule matching FiniteField not working? [closed]
I am introducing a rule: $Post = # /. x_?NumericQ FiniteField[q_?PrimeQ] [s_] :> FiniteField[q] [x] FiniteField[q] [s] &; But for some reason, upon ...
4 votes
1 answer
268 views
treating the rule itself as a pattern
My goal is to count cases of {"Yes", _, _} -> "Yes" and {"Yes", _, _} -> "No" in the set below using HoldPattern to treat the rule itself as a pattern. ...
4 votes
7 answers
543 views
2 votes
0 answers
89 views
Doubt about ReplaceRepeated?
I made the following code: L={{1,2},{2,3},{2,4}}; R:=(L=(L/.{x_,y_}:>Splice[{{x,y},{x,x},{y,y}}]/;MemberQ[L,{x,y}])//Union) When I run R three times, I get: <...
7 votes
3 answers
412 views
How to implement rule based transitive closure?
Given a relation L, we can make the symmetric closure using rules as follows: ...
2 votes
0 answers
169 views
Perturbation theory. Get xAct tensor component. Substitution for xAct tensors
I work with perturbations in FLRW metric with arbitary curvature. I'm following Weinberg's book. In modified gravitation theory there is additional tensor S and I need to find it's perturbation in the ...
0 votes
1 answer
73 views
Cross derivative rules
I am trying to generalize the condition Derivative[1, 0][ℒp][t, ϕ] -> Derivative[0, 1][ℒp][t, ϕ]/l for $\ell$ a constant, through the following rule ...
2 votes
1 answer
115 views
Removing `circular rules'
Say that I have a huge list (>300.000 elements) of polynomial equations and I want to simplify these by looking for some simple equations of the form x[i] == _ ...