mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
# Conflicts: # HISTORY.md # gulpfile.js # package-lock.json # package.json # src/core/function/typed.js # src/expression/transform/index.js # src/function/statistics/sum.js # src/function/utils/index.js # src/type/unit/Unit.js # src/version.js # test/expression/node/FunctionNode.test.js # test/type/unit/function/createUnit.test.js # test/utils/bignumber/formatter.test.js # test/utils/number.test.js
1.2 KiB
1.2 KiB
Function min
Compute the minimum value of a matrix or a list of values.
In case of a multi dimensional array, the minimum of the flattened array
will be calculated. When dim is provided, the minimum over the selected
dimension will be calculated. Parameter dim is zero-based.
Syntax
math.min(a, b, c, ...)
math.min(A)
math.min(A, dim)
Parameters
| Parameter | Type | Description |
|---|---|---|
args |
... * | A single matrix or or multiple scalar values |
Returns
| Type | Description |
|---|
- | The minimum value
Examples
math.min(2, 1, 4, 3) // returns 1
math.min([2, 1, 4, 3]) // returns 1
// minimum over a specified dimension (zero-based)
math.min([[2, 5], [4, 3], [1, 7]], 0) // returns [1, 3]
math.min([[2, 5], [4, 3], [1, 7]], 1) // returns [2, 3, 1]
math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1
math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5