Linked Questions

4 votes
2 answers
580 views

Split sorted list of integers by groups of consecutive integers [duplicate]

Im a trying to split a sorted 1D list of integers by sets of consecutives integers. The keywords in the question didn't trigger the answers I was looking for so I ask the question, no matter how ...
Christian Néel's user avatar
1 vote
1 answer
507 views

How to create sublists of consecutive elements? [duplicate]

I have a list of elements, for example: myList={5, 12, 16, 18, 19, 24, 28, 29, 31, 32, 35, 42, 43, 47, 50, 53, 60, 61, 62, 64, 79, 82, 84, 92, 105, 128, 136, 153, 154, 155, 156, 158, 159, 160, 164} ...
Jim's user avatar
  • 43
3 votes
3 answers
170 views

Easy way to covert a Range or set of vales to an Interval object [duplicate]

I am generating data such as {4,5,6,7,8,9,20,21,22,23,24,25,78,79,90}. This list can reach thousands of elements. Is there a simple or good method to convert such a list into a set on Interval ...
Lorenz H Menke's user avatar
2 votes
1 answer
106 views

Partition lists into sub-lists based on whether they are consecutive or not [duplicate]

I am new to Mathematica and would appreciate any help. I'd like to partition my data which is comprised of {time x analog input} into sublists of consecutive time. In other words, my data looks like ...
user45022's user avatar
604 votes
19 answers
158k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
50 votes
10 answers
13k views

Generating a Sierpinski carpet

I am trying to draw a Sierpinski_carpet. I have code that works, but I think there is a more elegant way to do than my way. Maybe I couls use Tuples or ...
chyanog's user avatar
  • 15.8k
39 votes
12 answers
3k views

Map a function across a list conditionally

It seems that this is a really basic question, and I feel that the answer should be obvious to me. However, I am not seeing. Can you please help me? Thanks. Suppose I have a list of data ...
Andrew's user avatar
  • 10.5k
46 votes
10 answers
6k views

Find zero crossing in a list

I'm looking for a function that finds the index of the zero-crossing points of a list. Before I go making my own subroutine to do this, I was wondering if anyone knows of any built-in Mathematica ...
dthor's user avatar
  • 1,011
21 votes
20 answers
11k views

Generating a list of numbers that are not multiples of 4

I want to write simple code that will list all numbers from $1$ to $n$ that are not multiples of $4$. And in this case I consider that ...
Narine's user avatar
  • 443
18 votes
14 answers
1k views

Count the sequences in an array

Is there a short and easier way to count number of sequences in a list? Let's say I have three lists: list1 = {0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0} ...
gurluk's user avatar
  • 475
23 votes
11 answers
1k views

Pick elements from list "separately"

I have the following list I want to pick elements from: mylist = {1, 5, 7, 3, 4, 7, 2, 9, 9, 1, 10, 12, 2, 64, 34, 64} I have another list with 0's and 1's which ...
holistic's user avatar
  • 3,045
17 votes
10 answers
3k views

Find longest sequence of zeros in list

How it is possible to find the length of the longest sequence of zeros in list {1,0,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,1} which is equal to 4 in the sample list above
Филипп Цветков's user avatar
17 votes
7 answers
5k views

How to find rows that have maximum value?

Suppose if I have following list { {10,b,30}, {100,a,40}, {1000,b,10}, {1000,b,70}, {100,b,20}, {10,b,70} } How to find rows that have max value in ...
Prashant Bhate's user avatar
13 votes
11 answers
570 views

Positions of elements in the initial flattened list in a split list

Say, we have a list: m1 = {2, 2, 7, 0, 7, 7, 2, 2, 2} It can be split easily: ...
garej's user avatar
  • 4,885
16 votes
9 answers
707 views

Dropping n consecutive terms from a list periodically

Suppose I have the following list lis = Range[100]; and I want to remove n consecutive terms periodically from the list. For example suppose I want to drop terms ...
RunnyKine's user avatar
  • 33.3k

15 30 50 per page