# All Questions

158 questions
Filter by
Sorted by
Tagged with
28 views

### Replacing factors that are only dependent on a single specific variable

I have expressions with terms that are products of factors. Some of the factors are expressions that depend on a single specific variable. I would like to replace those factors with constants and ...
147 views

### Creating rule-based sublists

I have a list each element of which consists of a list containing two strings and two integers: ...
98 views

### Find element in a list matching a pattern (using wildcards)

Somehow, I did not manage to find anything related to that. Suppose, in my Global list of variables, I would like to make a search such that I obtain all the ...
66 views

### Why does Shortest not work inside SequencePosition?

Why does Shortest not work in a SequencePosition call? The following two commands return the same answer: ...
80 views

### Using DeleteCases with a defined function with two arguments as a pattern

I am trying to manipulate some large datasets in Mathematica. I have plotted the data, and I would like to be able to easily remove points from the dataset, and it's fairly easy to identify the x-...
222 views

### Manipulating a general length function

As a minimal example, define a function like s[1,2,3]; this is a function of three arguments in this case, but I'd like to apply this general idea to functions like ...
65 views

### Dropping lists using pattern [duplicate]

I have the following list of lists. data = {{0, 0, 0}, {1, 0, 0}, {2, 0, 1}, {3, 0, 0}, {4, 0, 0}, {5, 0, 3}} I want to drop all the lists with ...
28 views

### Splitting a list of letters into subsequences starting with uppercase letters [duplicate]

Given a list of upper/lowercase characters, I'm trying to split it into subsequences that start with an uppercase and contain the next few (not necessarily positive number of) elements up until the ...
129 views

### Cases, Pattern, Condition [duplicate]

I supposed Cases would do the list produced as example li = RandomSample[Range[100, 999], 30] ...
36 views

### Reformatting the pattern inside a list

So, in principle, I have a simple problem which goes like this: I have vectors that should consist of lists of 2 numbers, see here: ...
52 views

### How can I replace non-reals in a multidimensional list?

Ok. I'm obviously not understanding something about pattern matching. I have a list called t like the following: ...
429 views

107 views

### How do I find and highlight the elements of a list that match a specific pattern?

I have a list of positive and negative ones {1,1,-1,1,1,-1,1,-1,1,-1,-1,1,1,1,-1} And I want to find and highlight the subsequence of the lists that have the pattern {...,1,1,___,-1,-1,...}. So ...
81 views

### Creating a dataset by matching one dataset to another

I have a dataset as a list paired terms {fruit1,fruit2}: Example: ...
83 views

### Repeated consecutive values above a threshold

I would like to know if a list has repeated consecutive values above a threshold. Lets say for this example the threshold is 5. ...
57 views

### How to match the iterative head in a iterative list

I want to delete the f[g[...]] last appear in a iterative list.Such as: ...
246 views

### How to copy with the last 1 with pattern matching method in a list

Suppose I have a list like {1, 2, 3, 1, 5, 8, 1, 9, 6} The {1, 2, 3, 1, 5, 8, 9, 6} is expected. Furthermore, if we want to ...
300 views

### Find the length of repeating numbers in a list

a = 4; primes = Prime[Range[PrimePi[10^(a - 1)] + 1, PrimePi[10^a]]]; d = 1; Cases[IntegerDigits[primes], {_, d .., _}] This gets me the list of the numbers from ...
547 views

### How to make a pattern to match?

Consider DeleteCases[{{1, 2, 3, 4}, {1, 3, 4, 5}}, {_, 3, __}] {{1, 2, 3, 4}} i.e., keep only those lists that don't have 3...