Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the maximal item in terms of canonical ordering
ResourceFunction["Maximal"][list] returns the canonically maximal item in list. | |
ResourceFunction["Maximal"][list,p] uses the ordering function p. |
Using canonical ordering, return the maximal item:
In[1]:= |
Out[2]= |
If the last item is dropped, the more numerically complicated item is returned:
In[3]:= |
Out[3]= |
Sort the items:
In[4]:= |
Out[4]= |
The numeric maximum is different:
In[5]:= |
Out[5]= |
Use a different ordering function to obtain the same result:
In[6]:= |
Out[6]= |
Use Maximal on an association:
In[7]:= |
Out[7]= |
Use Maximal on a sparse vector:
In[8]:= |
Out[8]= |
Find the item with the largest second item using an ordering function:
In[9]:= |
Out[9]= |
The result of the function MaximalBy has a similar form:
In[10]:= |
Out[10]= |
This work is licensed under a Creative Commons Attribution 4.0 International License