Linked Questions

37 votes
9 answers

How to select minimal subsets?

I am a newbie, so please point me in the right direction if you feel this question has been answered somewhere else before. Here goes: Suppose I have a list like this: ...
MrDas's user avatar
  • 473
41 votes
10 answers

Happy 2K prime question

This being the Q number 2K in the site, and this being the day we got the confirmation of graduating soon, I think a celebration question is in order. So... What is the fastest way to ...
25 votes
7 answers

Permutations[Range[12]] produces an error instead of a list

This input: Permutations[Range[12]] Results in this (error) output: ...
Harold's user avatar
  • 1,017
27 votes
6 answers

Faster alternatives for DayOfWeek

It has been noticed on several occasions that DayOfWeek function is rather slow when applied to a large list of dates, e.g. in this recent question. What faster ...
Leonid Shifrin's user avatar
23 votes
11 answers

Generating an ordered list of pairs of elements from ordered lists

I have a pair of ordered lists. I want to generate a new ordered list (using the same ordering) of length n by applying a binary operator to pairs of elements, one from each list, along with the index ...
TheDoctor's user avatar
  • 2,870
20 votes
6 answers

Determine the Number of Lines in a Text File

I have looked and looked but I do not see a simple efficient way to get Mathematica to return the number of lines in a text file? I thought about reading the file until it returned the EOF marker, ...
Sinistar's user avatar
  • 1,029
20 votes
5 answers

Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched?

This might seem like an overly simple question, but I need to specify custom plot tick marks as integers (no trailing decimal point) if they are approximately integers, but not if they are not. Using <...
Verbeia's user avatar
  • 34.3k
28 votes
3 answers

Reading periodic elements from a large file

I have a large binary data file (big endian) with 100+ million "rows" of 11 elements, combination of floats and integers. This is the format: ...
s0rce's user avatar
  • 9,652
25 votes
4 answers

Detecting patterns of black and white stones on a 2D board

I'm writing a program to play a game of Pente, and I'm struggling with the following question: What's the best way to detect patterns on a two-dimensional board? For example, in Pente a pair of ...
Victor K.'s user avatar
  • 5,191
20 votes
2 answers

Speeding up Import and Export in CSV format

I am handling large numerical data in Mathematica. In smaller problems everything worked fine using Export and Import with the ...
Richi W's user avatar
  • 323
21 votes
4 answers

How to find longest monotonic sequence?

I have a list, for example list = {2, 1, 3, 5, 4, 6} How to find longest ascending sequence of this list? There are two meanings of this question: Find the ...
ybeltukov's user avatar
  • 43.8k
14 votes
5 answers

Match opening and closing parentheses?

Suppose I have a List of the form: lst={"(", "(", "(", ")", "(", ")", ")", ")"} By running ...
a06e's user avatar
  • 11.4k
15 votes
3 answers

Nontrivial background removal

I have an image of a product on a poorly made green screen and need to segment out just the product: The problem is that it contains a mirror, so simple color-based methods are not enough. I tried ...
M.R.'s user avatar
  • 31.6k
31 votes
1 answer

Programmatically retrieving e-mails from a remote server

Mathematica has a function for sending mail (SendMail) and can import the MBOX format. But what I'd like to do is ...
Szabolcs's user avatar
  • 236k
11 votes
3 answers

Dynamic graph visualisation using JLink/Java and GraphStream

Visualising the addition of new nodes and edges to a graph to 'watch it grow' is to something Mathematica is not suited to by default. However this type of animation really helps convey the emergence ...
Cameron Murray's user avatar

15 30 50 per page