minimum(A,dims)

minimum(A, dims)

Compute the minimum value of an array over the given dimensions.

Examples

  1. Find the minimum value in an array:

    julia> arr = [5, 10, 2, 8, 3];
    julia> minimum(arr)
    2

    This example finds the smallest element in the array arr.

  2. Find the minimum value in a range of numbers:

    julia> minimum(1:10)
    1

    It determines the minimum value in the range from 1 to 10.

  3. Find the minimum value in a vector of strings:
    julia> words = ["apple", "banana", "orange"];
    julia> minimum(words)
    "apple"

    It identifies the minimum string based on lexicographic order.

Common mistake example:

julia> minimum([])
ERROR: MethodError: no method matching minimum(::Array{Any,1})

In this example, an empty array is passed to the minimum function, resulting in a MethodError. Ensure that the collection passed as an argument is not empty to avoid such errors.

See Also

Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: