Linked Questions

2
votes
2answers
199 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 ...
1
vote
1answer
324 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} ...
3
votes
3answers
100 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 ...
2
votes
1answer
62 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 ...
528
votes
19answers
132k 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 ...
49
votes
10answers
11k 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 ...
38
votes
12answers
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 ...
19
votes
17answers
7k 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 ...
43
votes
8answers
4k 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 ...
16
votes
10answers
848 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} ...
17
votes
7answers
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 ...
15
votes
8answers
2k 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
16
votes
9answers
671 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 ...
10
votes
9answers
984 views

Determine repeating number of a given number and corresponding position

For instance, the data is as follows: data = {1, 1, 1, -1, -1, 1, 1, -1} The target output when determining how many times "1"...
16
votes
6answers
522 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 ...

15 30 50 per page