Max
The largest of its arguments.
MaxFungrim entry632d1cbfe28bWolfram LanguageMax!SageMathenumeratio_max($*,)SymPyenumeratio_max($*,)Juliaenumeratio_max($*,)Max(a, b, …)the largest of two or more values.Max(list)the largest value in a list.Max(finset)the largest member of a Finset.Typed signatures
| Type | Package | Applies |
|---|---|---|
(value*) -> number | analyticreplaces compute-engine | always |
(value*) -> number | compute-engine | always |
(any*) -> any | combinatoricsreplaces structures | on Finset |
(any*) -> any | structuresreplaces analytic | always |
Details
- The largest of its arguments, or of a single list argument.
- Multiple arguments -- lists included -- are flattened into one pool rather than compared pairwise or threaded element-wise. See Min.
- Commutative and associative: order and grouping don't matter.
- NaN poisons the result: it beats every other comparison, even .
- With no arguments, compute-engine returns NaN rather than , the true identity element.
- Takes a Finset too: its largest member, and NaN for the empty one, as for an empty list.
Examples
1 more kept as data, checked against the oraclesProperties #
Possible issues #
ComplexInfinity is unordered, so Max cannot compare it: the call stays unevaluated, as in Wolfram
live ↗About
| Examples | 24 |
|---|---|
| Checked against | Wolfram Language 19 agree5 differSageMath 18 agree1 differ1 unevaluated3 errorSymPy 17 agree4 differ3 errormathlib4 9 agree6 errorJulia 15 agree1 unevaluated4 errorRust 4 agree2 error |
| Crosswalk | FungrimFungrim entry ×2Wolfram LanguageSageMathSymPyJuliaRust |
Implementation
mathlib4packages/oracle/src/mappings.tsThe largest of the arguments as exact rationals. Several arguments are the pool; a lone argument is a list of numbers. The empty pool (ours is NaN) and a nested list (ours flattens it) fail to elaborate rather than defaulting.
mathlib4packages/oracle/src/mappings.tsA single list of numbers; a lone number fails to elaborate.
wolframpackages/oracle/src/mappings.tsWolfram (and our Max) flattens nested lists into one pool; bare SymPy Max()/Sage max() on a list (or a list of lists) either raise or compare lexicographically instead, so both go through a flattening helper (run.ts's SYMPY_PREAMBLE / SAGE_PREAMBLE).
sympypackages/oracle/src/mappings.tsWolfram (and our Max) flattens nested lists into one pool; bare SymPy Max()/Sage max() on a list (or a list of lists) either raise or compare lexicographically instead, so both go through a flattening helper (run.ts's SYMPY_PREAMBLE / SAGE_PREAMBLE).
sagepackages/oracle/src/mappings.tsWolfram (and our Max) flattens nested lists into one pool; bare SymPy Max()/Sage max() on a list (or a list of lists) either raise or compare lexicographically instead, so both go through a flattening helper (run.ts's SYMPY_PREAMBLE / SAGE_PREAMBLE).
juliapackages/oracle/src/mappings.tsrustpackages/oracle/src/mappings.tsTwo operands.