# max_value function

The maximum value of an expression.

## How to write it

### max_value(expr, variables)

The greatest value over every real value of the variables.

**expr**

Any expression: a number, a formula, a list or a matrix. Takes an expression.

**variables**

A variable, or a list of variables such as \[x, y\]. Takes a variable, or a list of variables.

### max_value(expr, variables)

The greatest value under conditions, without the point.

**expr**

The objective first, then its conditions, in brackets. Takes a list.

**variables**

A variable, or a list of variables such as \[x, y\]. Takes a variable, or a list of variables.

## Examples

- $\displaystyle \operatorname{max\_value}(-x^{2}+2 x, x) = 1$

  `max_value(-x^2 + 2x, x)`

  In the solver, `max_value(-x^2 + 2x, x)` gives `1`.

  [Open in the solver](https://hilberon.com/?q=max_value%28-x%5E2%20%2B%202x%2C%20x%29)
- $\displaystyle \operatorname{max\_value}(\left[ x^{2}+y^{2}, x+2 y \le 8, 3 x+y \le 9, x \ge 0, y \ge 0, \left[ x, y \right] \in \mathbb{Z} \right], \left[ x, y \right]) = 16$

  `max_value([x^2 + y^2, x + 2y <= 8, 3x + y <= 9, x >= 0, y >= 0, [x, y] : integer], [x, y])`

  In the solver, `max_value([x^2 + y^2, x + 2y <= 8, 3x + y <= 9, x >= 0, y >= 0, [x, y] : integer], [x, y])` gives `16`.

  [Open in the solver](https://hilberon.com/?q=max_value%28%5Bx%5E2%20%2B%20y%5E2%2C%20x%20%2B%202y%20%3C%3D%208%2C%203x%20%2B%20y%20%3C%3D%209%2C%20x%20%3E%3D%200%2C%20y%20%3E%3D%200%2C%20%5Bx%2C%20y%5D%20%3A%20integer%5D%2C%20%5Bx%2C%20y%5D%29)

## Related functions

- [min_value](https://hilberon.com/library/min_value)

  The minimum value of an expression.
- [maximize](https://hilberon.com/library/maximize)

  The maximum of an expression and the point where it is reached.
- [numeric_minimize](https://hilberon.com/library/numeric_minimize)

  The minimum of an expression found numerically, with the point where it is reached.
- [numeric_maximize](https://hilberon.com/library/numeric_maximize)

  The maximum of an expression found numerically, with the point where it is reached.
- [minimize](https://hilberon.com/library/minimize)

  The minimum of an expression and the point where it is reached.

---
Source: https://hilberon.com/library/max_value
