# Tag Info

Accepted

### What is an easy way to transform an equality into a replacement rule?

With: eqns = (a == 1 && b == 2 && c == 0) Just use a built-in function: ToRules[eqns] ...
• 14.2k

### Removed all undefined from a list of rules

Select only NumericQ solution Select[rules, NumericQ[Last[#]]&] Or delete the instances ...
• 28.5k
Accepted

### Removed all undefined from a list of rules

t = rules /. HoldPattern[x_ -> Undefined] -> Nothing EDIT Another variation: Values[rules] can be used: (Also try ...
• 14.2k

### What is an easy way to transform an equality into a replacement rule?

Another way is the following: ReplaceAll[Equal -> Rule][Level[eqns, {1}]] (*{a -> 1, b -> 2, c -> 0}*)
• 3,648

### What is an easy way to transform an equality into a replacement rule?

I expect there will be many solutions, probably the best alternative is to use ToRules, as suggested by @Syed. Anyhow, here I present you with two other simple ways....
• 28.5k
Accepted

### ReplaceAll with Powers

What about a^2/b^2 /.a->b c (*c^2*)
• 36.3k

### What is an easy way to transform an equality into a replacement rule?

Another way is to use Block. It uses the same idea that @rhermans suggested as you see; it redefines List and ...
• 5,594
Accepted

### Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output

I want to add this reply in response to the comment written under the OP. The function Values does not work, as all the elements of the list are not rules. (the ...
• 5,594

### Replace list of list according to second list

☺ = # /. ({#, _} -> {##} & @@@ #2) &; p ~ ☺ ~ t1 {{2, 0}, {3, 0}, {4, 0}, {5, 1}, {8, 0}, {11, 1}}
• 348k

### Removed all undefined from a list of rules

We can use DeleteCases as follows: ...
• 348k

### Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output

Let ruleNixer = Rule[_, v_] :> v; Example1 from the docs: FindMinimum[x Cos[x], {x, 2}] {-3.28837, {x -> 3.42562}} <...
• 14.2k

### Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output

If you're needing to handle output from FindMinimum specifically, then since you know that structure you know how to "re-structure" it: ...
• 3,452

### What is an easy way to transform an equality into a replacement rule?

My method was to simply use a table to iterate over each element of the collection of equality and re-write them as a replacement rule: ...
• 635
Accepted

### Tropical Operation Conversions: Multiple Operations

I assume that you want to replace Addition by "Max" and Multiplication by addition. It is not clear how a negative term should be treated. For the time being I assume that it will be ...
• 23.9k
Accepted

### Replacement, PatternTest, Module related Question

The reason your attempt fails is that at the time the Function is applied to its arguments, m has not yet been replaced by ...
• 23.2k
Accepted

### Classifying elements, by the value of a fixed function, using Replace

L = Table[ConstantArray[1, RandomInteger[999]], 100000]; m = Replace[L, {x_List :> Quotient[Length@x, 100]}, {1}]; \{7,2,8,8,6,5,1,5,2,1,1,3,6,7,2,4,7,2,1,8,...
• 14.2k

### Tropical Operation Conversions: Multiple Operations

I'm not entirely sure if this is what you're looking for, but it seems you would just need to replace your x_ with x__ ...
• 2,843

### Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output

Odds and ends Single and two-variable examples: ...
• 212k

### Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output

These methods work correctly with any number of variables of any dimensionality: ...
• 55.4k
Accepted

### Replace list of list according to second list

f = Values @ GroupBy[Join @ ##, First, Last] &; f[p, t1] {{2, 0}, {3, 0}, {4, 0}, {5, 1}, {8, 0}, {11, 1}}
• 348k

### Replace list of list according to second list

pos = Position[p[[All, 1]], #] & /@ First /@ t1 {{{4}}, {{6}}} ReplacePart[p, Thread[pos -> t1]] {{2, 0}, {3, 0}, {4,...
• 14.2k

### What is an easy way to transform an equality into a replacement rule?

The following also works: ...
• 5,594

### What is an easy way to transform an equality into a replacement rule?

Another way of obtaining the desired output is: ...
• 5,594

### What is an easy way to transform an equality into a replacement rule?

Similarly, one can go about it in the following manner: ...
• 5,594

### What is an easy way to transform an equality into a replacement rule?

Since we did all the normal ways, the following is fun. Extract the values and the parameters from the output of Reduce using ...
• 5,594
Accepted

### How to use "Replace" in matrix?

If B is found in the result you can replace it by Defer[B]: ...
• 19k

### Replace list of list according to second list

Slightly different p2 to include duplicates/same t1: ...
• 14.2k
Accepted

### ReplaceAll not working with change of sign

I'm not a big fan of using ReplaceAll as a way of asserting arithmetic relationships, but if that's what you really want, then try something like this: ...
• 3,452
1 vote

### How to replace derivatives of a function with symbolic symbols and numbers with a replacement rule? (I.e. U'' maps to u2)

It is generally easier to deal with indexed variables and to format them for display in any desired manner. ...
• 119k

Only top scored, non community-wiki answers of a minimum length are eligible