Linked Questions

6 votes
7 answers
390 views

How to find the smallest position of an element of an ascending list {1,4,10,12,20} such that the element is not less than 11?

Assume I have an ordered, ascending list {1,4,10,12,20}. I want to find the smallest position of an element of the list such that the element is not less than 11? ...
20 votes
4 answers
3k views

Fastest way to check for list membership

I have a set of say 100 numbers {1,3,7,11,19,...3971}. All elements are previously determined. I want to check whether ...
5 votes
4 answers
632 views

Inserting an integer into a sorted list

I'm wondering if inserting an integer into a sorted list (in a way that the list remains sorted) can be performed in Mathematica in some fancy way in $\log(N)$ time?.. The question was asked here, ...
183 votes
6 answers
24k views

How to compile effectively?

What are the best practices of compiling functions? I understand that this is a vague question, but let me list some aspects that might trigger useful answers. Some of these have already been answered ...
156 votes
9 answers
15k views

General strategies to write big code in Mathematica?

I think after six months of exposure to Mathematica and the Wolfram Language I am fairly OK with writing short codes and snippets. However, what are some general strategies to use in order to write ...
15 votes
3 answers
2k views

Is there a built-in function to do binary search?

Is there a built-in function to do binary search? Say, given a list (sorted) and a number, find the position which keeps the listed sorted when the number is inserted. I know that ...
6 votes
4 answers
663 views

Find min and max indices of highest and lowest elements in sorted list

I have a list of integers of the form ...
10 votes
4 answers
658 views

Taking Part of an InterpolatingFunction

I want a function to extract part of a one-dimensional InterpolatingFunction, similar to how Take works on lists. Based on the ...
10 votes
2 answers
404 views

How to parallelize and speedup AppendTo? [duplicate]

Say I have a list of original data (for now generating random list as follows): ...
8 votes
2 answers
2k views

Best way to insert element into an ordered list at the correct position?

Suppose I have an ordered list orderedList and I want to write some code that will involve regularly inserting new elements into ...
47 votes
5 answers
2k views

How can the behavior of InterpolationOrder->0 be controlled?

In ListPlot and Interpolation, the option InterpolationOrder->0 uses two different ...
17 votes
2 answers
230 views

Most efficient numerical selectBetween

Often when I'm working with numerical data I want to select those points within a given range. To do this I generally do something like: ...
1 vote
1 answer
107 views

Choosing data from list and plot [duplicate]

I have a data set like below: Angle={5.48575, -0.669213, 45.9832, 8.63878, -16.8777, 50.022, -41.8882, -45.956, 28.3005, 35.8234} Now want to select the ...
24 votes
4 answers
2k views

How to reduce the InterpolatingFunction building overhead?

I want a linear interpolation from the following example list: ...
99 votes
4 answers
4k views

What best practices or performance considerations are there for choosing between Cases, Position, Pick and Select?

Cases, Select,Pick and Position each have different ...

15 30 50 per page