Function Repository Resource:

# Minimal (1.0.0)current version: 1.1.0 »

Get the minimal item in terms of canonical ordering

Contributed by: Wolfram Staff
 ResourceFunction["Minimal"][list] returns the canonically minimal item in list. ResourceFunction["Minimal"][list,f] uses the ordering function f.

## Details

Values of list are compared using the same canonical order as in Sort.
Use MinimalBy instead to order through a criterion function.
In a numerical list, Ordering[list,n] gives the positions of the n smallest elements. Ordering[list,-n] gives the positions of the n largest elements.
If there are several smallest elements in list, Ordering[list,1] will give only the position of the one that appears first.

## Examples

### Basic Examples (4)

Using canonical ordering, return the minimal item:

 In[1]:=
 Out[2]=

Sort the items:

 In[3]:=
 Out[3]=

The numeric minimum is different:

 In[4]:=
 Out[4]=

Use a different ordering function to obtain the same result:

 In[5]:=
 Out[5]=

### Scope (2)

Use Minimal on an association:

 In[6]:=
 Out[6]=

Use Minimal on a sparse vector:

 In[7]:=
 Out[7]=

### Properties and Relations (2)

Find the item with the smallest second item using an ordering function:

 In[8]:=
 Out[8]=

The result of the function MinimalBy has a similar form:

 In[9]:=
 Out[9]=

## Version History

• 1.1.0 – 30 January 2023
• 1.0.0 – 14 February 2022