Linked Questions

0 votes
2 answers
224 views

Sorting non-numerical lists [duplicate]

The Sort function will by default sort from lowest to highest. In[1]:= Sort[{3, 1, 4}] Out[1]= {1, 3, 4} However, if the list ...
Klyk's user avatar
  • 85
2 votes
1 answer
158 views

Sort bug in Mathematica 10? [duplicate]

When I input Sort[{-Sqrt[3],0}] I get {0,-Sqrt[3]} This can't be right, can it?
matrixbud's user avatar
  • 435
4 votes
2 answers
200 views

Problems with MinimalBy, MaximalBy, SortBy [duplicate]

...
qwerty's user avatar
  • 1,199
0 votes
1 answer
245 views

Problem with Sort - unexpected order with Sqrt [duplicate]

Sort[{13, Sqrt[157], Sqrt[163]}] (*{13, Sqrt[157], Sqrt[157]}*) Sort[{13, Sqrt[157], Sqrt[157]}, #1 < #2 &] (*{Sqrt[157], Sqrt[157], 13}*) This seems ...
retnuH's user avatar
  • 103
3 votes
2 answers
40 views

Strange behavior of MinimalBy [duplicate]

data = {{1, 2}, {2, 2}, {3, 3}}; MinimalBy[data, Norm@# &] Output: {{2, 2}} When applying numerically : ...
lesobrod's user avatar
  • 1,667
1 vote
1 answer
203 views

Sort does not sort {0, -Pi/2} [duplicate]

Why is this list returned unchanged by Sort? Sort[{0,-Pi/2}] {0,-Pi/2} While this list is returned reversed? Sort[{0,-1}] ...
Ralph Dratman's user avatar
550 votes
37 answers
131k views

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
20 votes
9 answers
2k views

Find second largest elements in list

Given a list: lis = {37.21, 37.21, 37.2, 44, 44, 44, 101, 101} What is a simple way to extract the second largest elements? ...
Conor's user avatar
  • 7,449
19 votes
1 answer
30k views

Table - find index of the maximum element [duplicate]

Let's suppose that I have table t = {1.23, 3.4, 10, 34, 1.78, 0.98, 12.56}. To take the biggest element I can use Max[t] ...
Ziva's user avatar
  • 827
18 votes
5 answers
7k views

Define a mathematical set

I have a terribly short question: Is there a way to define a pure mathematical set? I tried a bit of googling, but the word "set" has two meanings and the other one (as in setting) as by far more ...
Dror's user avatar
  • 1,851
34 votes
3 answers
2k views

Is there a "precedence table" for the canonical Sort ordering?

This answer in which I wrote about the Operator Precedence Table was unexpectedly popular. That got me thinking about similar things, and I am wondering: Does an "ordering table" exist for the ...
Mr.Wizard's user avatar
  • 272k
7 votes
2 answers
599 views

Finding the two pairs in a list of pairs that minimize and maximize a given function

I need to declare a list of ordered pairs, and with it I need to declare a function of two variables, say x and y, and print ...
bfhg17's user avatar
  • 71
12 votes
2 answers
792 views

Surprises simplifying simple polynomials

I came across some somewhat surprising behavior of Simplify today, on something very simple. Let's take two cubic polynomials that we know have the same value: <...
Pillsy's user avatar
  • 18.5k
11 votes
2 answers
502 views

SortBy misbehaving?

It maybe a stupid thing in the end but I'm stuck a couple of hours now. I have a list of 2 points on the plane and I want to get the one with the biggest second coordinate. I thought I knew how ...
tst's user avatar
  • 953
4 votes
2 answers
1k views

ordering of functional eigenvalues

Is there any order to the symbolic eigenvalues of a matrix returned by the command Eigenvalues[...]? While numerical eigenvalues are listed in descending order (i....
user001's user avatar
  • 1,397

15 30 50 per page