Linked Questions

2
votes
4answers
1k views

Cases vs Select, Pattern vs Pure function [duplicate]

What is the difference between having Cases with selection condition presented by pattern and a with pure function as condition? ...
2
votes
2answers
353 views

Selecting list entries with a True False index list of similar length [duplicate]

I would like to determine which elements in a list are divisible by a specific number, lets say 3. I generate a list with numbers: numbers = Range[10]; I then ...
3
votes
1answer
74 views

Whats the difference between Cases and Select? [duplicate]

Im trying to further my understanding of mathematica coding and came up across this question. What is the main difference between Cases and ...
164
votes
19answers
11k views

What are some useful, undocumented Mathematica functions?

There have already been some questions about some undocumented functionality in Mathematica. Such as (please add to these lists!) How can one find undocumented options or option values in Mathematica?...
164
votes
6answers
19k 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 ...
30
votes
6answers
4k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
17
votes
7answers
927 views

How to find all the positions of max value of a list efficiently?

For Example, list=RandomInteger[{1,100},2000]. Yes,I know Position[list,Max[list]] can do. But it's based on pattern matching!...
22
votes
3answers
1k views

Select performance

I am fairly new to mathematica and working my way thru Paul Wellins book on Mathematica programming so experimenting with various language constructs. I was experimenting with ...
50
votes
1answer
2k views

What are SparseArray Properties? How and when should they be used?

A strange undocumented form of SparseArray is increasingly used in answers on this site: ...
28
votes
2answers
733 views

How can I ensure that I am constructing patterns in the most efficient way possible?

Inspired by this answer, I am interested to know if there are best practices or rules of thumb for constructing patterns, for example for use in function definitions (...
13
votes
2answers
3k views

How do I find the elements in a list that return the highest value for a function?

Suppose we have a list of values and a function f. I want to find which of the elements maximizes the return value of the function in Mathematica. Let call the ...
9
votes
2answers
506 views

Matching pair of numbers {a,-a}, where a is numeric

Imagine you have a list of pairs of numbers, such as {{2,-2}, {1,5}, {1,-3},{-3,3}} The task is to reduce the given list to a list of pairs of type ...
6
votes
1answer
622 views

Finding the longest word in a list (WordList[])

Hi guys I am having problems with finding the longest word available in WordList["English"] I have found that the longest word has 24 characters thanks to this ...
5
votes
1answer
139 views

Why Cases and Select treat the List differently?

Look at these two examples: In[1]:=Select[f[i], MatchQ[_f]] Out[1]:=f[] In[2]:=Cases[f[i],_f] Out[2]:={} It seems that the Select take $f[i]$ as List, but Cases ...
4
votes
2answers
105 views

Deleting unwanted elements in lists of words

I have imported Alice in Wonderland into Mathematica. I have made a list of the sentences and further divided them into words. Now suppose, nominally, I have the following list: ...

15 30 50 per page