We deliver solutions for the AI eraâcombining symbolic computation, data-driven insights and deep technology expertise.
TakeSmallest[data,n]
gives the n smallest elements of data, sorted in ascending order.
TakeSmallest[dataprop,n]
gives the property prop for the n smallest elements in data.
TakeSmallest[data,n,p]
uses the order function p for sorting.
Details and OptionsTake the two smallest numbers in a list:
Do the same using the operator form of TakeSmallest:
Get the three smallest quantities in a list of Quantity objects:
Quantities can be present in multiple units:
Get the two least recent dates in a list of DateObject constructs:
Take the three smallest values in an association:
Scope (9)Take the four smallest numbers or as many as are available if fewer:
Quantities can be given as QuantityArray:
By default, Missing[] and several other symbolic expressions are excluded from the results:
Get the two smallest elements in a list:
Get the positions of the two smallest elements in a list:
Get the two smallest elements in a list along with their positions:
Get the two smallest elements in a list with their positions given first:
Get associations containing the element and position of the two smallest elements in a list:
Find the three smallest elements in a TabularColumn:
Get the four rows with the smallest element in the first column in a Tabular object:
Take a list of numeric expressions or infinities:
By default, TakeSmallest sorts the elements using NumericalOrder:
Use canonical Order instead:
Take a list of lists of integers:
They are not numeric elements, so they are sorted by default following canonical order:
Use instead lexicographic order, which will sort the list by their respective first elements:
Take a list of complex numbers:
Following NumericalOrder, TakeSmallest selects numbers with decreasing real part:
Options (2) ExcludedForms (2)By default, Missing[] and several other symbolic expressions are excluded from the results:
Specify which elements should be excluded:
By default, TakeSmallest takes all elements into account when finding the smallest ones:
Exclude elements matching a given pattern:
Applications (6)Get the three planets with the smallest radii:
Get the release dates of the five oldest James Bond movies:
Find the South American countries with the lowest life expectancy for their inhabitants:
Find the codons (groups of three consecutive nucleotides) with the lowest relative frequencies in the list of nucleotides of a gene:
Find the noble gases with the lowest boiling point and density:
Find the five least dense chemical elements:
Properties & Relations (6)TakeSmallest[list,n,p] is effectively equivalent to Take[Sort[list,p],n]:
TakeSmallest uses NumericalOrder as default ordering function p:
Using canonical order can give different results:
With numerical inputs, the result of TakeSmallest is determined by numerical comparisons:
Comparisons of non-numerical elements effectively follow canonical order:
Order is the default ordering function for Sort and ReverseSort:
TakeSmallest[data,…] operates at the first level of the input data:
If the input has several levels, it is still elements of the first level that will be sorted and extracted:
Unlike Min, TakeSmallest does not return values at deeper levels:
When different numerical expressions have the same value, their original order will be preserved:
TakeSmallest[list,n,p] is effectively equivalent to MinimalBy[list,Identity,n,p]:
Take a list of five dates in the current year:
Get the two earliest of the dates with TakeSmallest:
Get the second earliest of the dates with RankedMin:
Possible Issues (2)If fewer than the requested number of elements are present, TakeSmallest will not evaluate:
Use UpTo to get as many elements as possible:
If the elements are not comparable, TakeSmallest will not evaluate:
Wolfram Research (2015), TakeSmallest, Wolfram Language function, https://reference.wolfram.com/language/ref/TakeSmallest.html (updated 2025). TextWolfram Research (2015), TakeSmallest, Wolfram Language function, https://reference.wolfram.com/language/ref/TakeSmallest.html (updated 2025).
CMSWolfram Language. 2015. "TakeSmallest." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/TakeSmallest.html.
APAWolfram Language. (2015). TakeSmallest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TakeSmallest.html
BibTeX@misc{reference.wolfram_2025_takesmallest, author="Wolfram Research", title="{TakeSmallest}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/TakeSmallest.html}", note=[Accessed: 12-July-2025 ]}
BibLaTeX@online{reference.wolfram_2025_takesmallest, organization={Wolfram Research}, title={TakeSmallest}, year={2025}, url={https://reference.wolfram.com/language/ref/TakeSmallest.html}, note=[Accessed: 12-July-2025 ]}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4