Skip to main content
7 votes
Accepted

How to replace C[1] in solutions of trigonometric equations into k?

In addition to using rules you can useGeneratedParameters, e.g. ...
ubpdqn's user avatar
  • 61.6k
5 votes

How to do this replacement? Match the variable, but not the function

You can replace \[Lambda][\[Theta]] with \[Lambda] first, and then replace \[Lambda] with <...
Jie Zhu's user avatar
  • 998
4 votes
Accepted

Multiple replacements in a long expression

Use ReplaceRepeated (//.) instead of ReplaceAll (/.). ...
Domen's user avatar
  • 26.5k
3 votes

How to replace one part of list of lists

list = {{49, 35, 14}, {64, 40, 16}, {81, 45, 18}}; Using Cases ...
eldo's user avatar
  • 75.1k
2 votes

Using PatternSequence on its own in ReplaceAll?

list = {0, 1, 2, 0, 1, 3, 0, 1, 4}; Since V 11.3 we have SequenceReplace ...
eldo's user avatar
  • 75.1k
2 votes

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

eqns = (a == 1 && b == 2 && c == 0); Using MapApply (new in 13.1) ...
eldo's user avatar
  • 75.1k
2 votes

Replacing a sub-partition (unordered list; multiset)

list = {{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1}}; A variant of 1066's answer using SequenceReplace (new in 11.3) ...
eldo's user avatar
  • 75.1k
2 votes

Replace number in string with ? and /;

list = {"A4", "A#3"}; Map[StringJoin, Characters[list] /. {"A", d_?DigitQ, ___} :> {"B", d}] {"B4", "A#...
eldo's user avatar
  • 75.1k
2 votes

Multiple replacements in a long expression

This seems to be a bug in ReplaceAll. ReplaceAll is supposed to work for any head of an expression. However, if the head is "Plus" you got the above error: However, if you put the first 2 ...
Daniel Huber's user avatar
  • 52.7k
1 vote

How to make expression-dependent replacements?

For a list of sublists of this type: ...
RGL's user avatar
  • 101
1 vote

How can I remove empty lists { } from a nested list?

list = {{{1}, {2}, {1, 2}, {1, 2, 3}, {}, {}}, {{2}, {3}, {}}} Using SequenceCases ...
eldo's user avatar
  • 75.1k
1 vote

How do I remove parts of this data?

list = {{9.9, 0}, {"", ""}, {10.0, -21.7}, {"", ""}, {10.0, 28.5}, {"", ""}}; Using ...
eldo's user avatar
  • 75.1k
1 vote

Sublist pattern matching

list = {{1, 2, 3}, {1, 2, 3}, {1, 2, 2, 3}, {1, 3, 3, 5}}; Using SequenceSplit (new in 11.3) ...
eldo's user avatar
  • 75.1k
1 vote

Appending to sublists using "anchor" values

Using GroupBy and Splice (new in 12.1) ...
eldo's user avatar
  • 75.1k

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