Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Maximize a function (maximize)

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

How to write it

maximize(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.

maximize(expr, variables)

Under conditions, over whole unknowns too, and with the least of several linear pieces.

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

  • max⁡x(−x2+2x)=[1,[x→1]]\displaystyle \max_{x} (-x^{2}+2 x) = \left[ 1, \left[ x \to 1 \right] \right]
    maximize(-x^2 + 2x, x)

    In the solver, maximize(-x^2 + 2x, x) gives [1, [x -> 1]].

    Open in the solver
  • max⁡x,y[5x+4y,6x+4y≤24,x+2y≤6,x≥0,y≥0,[x,y]∈Z]=[20,[x→4,y→0]]\displaystyle \max_{x, y} \left[ 5 x+4 y, 6 x+4 y \le 24, x+2 y \le 6, x \ge 0, y \ge 0, \left[ x, y \right] \in \mathbb{Z} \right] = \left[ 20, \left[ x \to 4, y \to 0 \right] \right]
    maximize([5x + 4y, 6x + 4y <= 24, x + 2y <= 6, x >= 0, y >= 0, [x, y] : integer], [x, y])

    In the solver, maximize([5x + 4y, 6x + 4y <= 24, x + 2y <= 6, x >= 0, y >= 0, [x, y] : integer], [x, y]) gives [20, [x -> 4, y -> 0]].

    Open in the solver
  • max⁡x,y[min⁡(x,y,6−x−y),x≥0,y≥0]=[2,[x→2,y→2]]\displaystyle \max_{x, y} \left[ \min(x, y, 6-x-y), x \ge 0, y \ge 0 \right] = \left[ 2, \left[ x \to 2, y \to 2 \right] \right]
    maximize([min(x, y, 6 - x - y), x >= 0, y >= 0], [x, y])

    In the solver, maximize([min(x, y, 6 - x - y), x >= 0, y >= 0], [x, y]) gives [2, [x -> 2, y -> 2]].

    Open in the solver
  • max⁡x,y[x2+y2,x+2y≤8,3x+y≤9,x≥0,y≥0,[x,y]∈Z]=[16,[x→0,y→4]]\displaystyle \max_{x, y} \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[ 16, \left[ x \to 0, y \to 4 \right] \right]
    maximize([x^2 + y^2, x + 2y <= 8, 3x + y <= 9, x >= 0, y >= 0, [x, y] : integer], [x, y])

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

    Open in the solver
  • max⁡x,y,z[xyz,x+y+z=3,x>0,y>0,z>0]=[1,[x→1,y→1,z→1]]\displaystyle \max_{x, y, z} \left[ x y z, x+y+z = 3, x > 0, y > 0, z > 0 \right] = \left[ 1, \left[ x \to 1, y \to 1, z \to 1 \right] \right]
    maximize([x*y*z, x + y + z = 3, x > 0, y > 0, z > 0], [x, y, z])

    In the solver, maximize([x*y*z, x + y + z = 3, x > 0, y > 0, z > 0], [x, y, z]) gives [1, [x -> 1, y -> 1, z -> 1]].

    Open in the solver

Functions its examples use

  • min

    The smallest of some numbers.

  • numeric_maximize

    The maximum of an expression found numerically, with the point where it is reached.

  • min_value

    The minimum value of an expression.

  • max_value

    The maximum value of an expression.

  • minimize

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

  • numeric_minimize

    The minimum of an expression found numerically, with the point where it is reached.