Skip to main content
2 of 5
added 33 characters in body
yohbs
  • 7.1k
  • 3
  • 30
  • 61

Sorting and keeping the main format of list numbers

I have a list with these elements:

list={1/2 (1 + Sqrt[5]), 1, 1, 1/2 (1 - Sqrt[5]), 0}; 

[![enter image description here][1]][1]

I want to sort them with

Sort[list]; 

I see the bellow result:

[![enter image description here][2]][2]

Which is incorrect, because N[1/2 (1 - Sqrt[5])]= -0.6, However I can write Sort[N[list]] but I need to have the exact numbers, not their approximate values (I mean that I need 1/2 (1 - Sqrt[5]) instead of -0.6). [1]: https://i.sstatic.net/ZWoFv.png [2]: https://i.sstatic.net/8WMYN.png

Unbelievable
  • 4.9k
  • 1
  • 22
  • 51