## `max` -- the maximum of numbers

#### Introduction

`max(`x1, x2, ...`)` returns the maximum of the numbers x1,x2,....

#### Call(s)

`max(x1, x2, ...)`

#### Parameters

`x1, x2, ...` | - | arbitrary MuPAD objects

#### Returns

one of the arguments, or a symbolic `max` call.

### Overloadable:

`x1`, `x2`, ``, `...`

#### Related Functions

`_leequal`, `_less`, `min`, `sysorder`

#### Details

- If the arguments of `max` are either integers, rational numbers, or floating point numbers, then `max` returns the numerical maximum of these arguments.
- The call `max(``)` is illegal and leads to an error message. If there is only one argument `x1`, then `max` evaluates `x1` and returns it (see example 2).
- If one of the arguments is `infinity`, then `max` returns `infinity`. If an argument is `-infinity`, then it is removed from the argument list (see example 3).
- `max` returns an error when one of its arguments is a complex number (see example 2).
- If one of the arguments is not a number, then a symbolic `max` call with the maximum of the numerical arguments and the remaining evaluated arguments is returned (see example 1).

  Nested `max` calls with symbolic arguments are rewritten as a single `max` call, i.e., they are flattened; see example 4.

- `max` does not react to properties of identifiers set via `assume`. Use `simplify` to handle this (see example 4).

- `max` is a function of the system kernel.

#### Example 1

`max` computes the maximum of integers, rational numbers, and floating point values:

    >> max(-3/2, 7, 1.4)

                                         7

If the argument list contains symbolic expressions, then a symbolic `max` call is returned:

    >> delete b: max(-4, b + 2, 1, 3)

                                   max(b + 2, 3)

    >> max(sqrt(2), 1)

                                        1/2
                                   max(2   , 1)

Use `simplify` to simplify `max` expressions with constant symbolic arguments:

    >> simplify(%)

                                        1/2
                                       2

#### Example 2

`max` with one argument returns the evaluated argument:

    >> delete a: max(a), max(sin(2*PI)), max(2)

                                      a, 0, 2

Complex numbers lead to an error message:

    >> max(0, 1, I)

          Error: Illegal argument [max]

#### Example 3

`infinity` is always the maximum of arbitrary arguments:

    >> delete x: max(100000000000, infinity, x)

                                     infinity

`-infinity` is removed from the argument list:

    >> max(100000000000, -infinity, x)

                               max(x, 100000000000)

#### Example 4

`max` does not take into account properties of identifiers set via `assume`:

    >> delete a, b, c:
       assume(a > 0): assume(b > a, _and): assume(c > b, _and):
       max(a, max(b, c), 0)

                                  max(a, b, c, 0)

An application of `simplify` yields the desired result:

    >> simplify(%)

                                         c

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000