Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Minimize a function (minimize)

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

How to write it

minimize(expr, variables)

The least 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.

minimize(expr, variables)

Under conditions: a linear program, whole unknowns written [x, y] : integer, abs and max, distances.

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

  • min⁡x(x2−2x)=[−1,[x→1]]\displaystyle \min_{x} (x^{2}-2 x) = \left[ -1, \left[ x \to 1 \right] \right]
    minimize(x^2 - 2x, x)

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

    Open in the solver
  • min⁡x,y(x4+y4−4xy+1)=[−1,[x→1,y→1]]\displaystyle \min_{x, y} (x^{4}+y^{4}-4 x y+1) = \left[ -1, \left[ x \to 1, y \to 1 \right] \right]
    minimize(x^4 + y^4 - 4x*y + 1, [x, y])

    In the solver, minimize(x^4 + y^4 - 4x*y + 1, [x, y]) gives [-1, [x -> 1, y -> 1]].

    Open in the solver
  • min⁡x,y[x+y,x+2y≥4,3x+y≥6,x≥0,y≥0]=[145,[x→85,y→65]]\displaystyle \min_{x, y} \left[ x+y, x+2 y \ge 4, 3 x+y \ge 6, x \ge 0, y \ge 0 \right] = \left[ \frac{14}{5}, \left[ x \to \frac{8}{5}, y \to \frac{6}{5} \right] \right]
    minimize([x + y, x + 2y >= 4, 3x + y >= 6, x >= 0, y >= 0], [x, y])

    In the solver, minimize([x + y, x + 2y >= 4, 3x + y >= 6, x >= 0, y >= 0], [x, y]) gives [14/5, [x -> 8/5, y -> 6/5]].

    Open in the solver
  • min⁡x,y[2x+3y,x+y≥72,x−y≤1,x≥0,y≥0,[x,y]∈Z]=[10,[x→2,y→2]]\displaystyle \min_{x, y} \left[ 2 x+3 y, x+y \ge \frac{7}{2}, x-y \le 1, x \ge 0, y \ge 0, \left[ x, y \right] \in \mathbb{Z} \right] = \left[ 10, \left[ x \to 2, y \to 2 \right] \right]
    minimize([2x + 3y, x + y >= 7/2, x - y <= 1, x >= 0, y >= 0, [x, y] : integer], [x, y])

    In the solver, minimize([2x + 3y, x + y >= 7/2, x - y <= 1, x >= 0, y >= 0, [x, y] : integer], [x, y]) gives [10, [x -> 2, y -> 2]].

    Open in the solver
  • min⁡x,y[∣x−2∣+∣y+1∣+∣x+y−5∣,x≥0,y≥0]=[4,[x→5,y→0]]\displaystyle \min_{x, y} \left[ \left| x-2 \right|+\left| y+1 \right|+\left| x+y-5 \right|, x \ge 0, y \ge 0 \right] = \left[ 4, \left[ x \to 5, y \to 0 \right] \right]
    minimize([abs(x - 2) + abs(y + 1) + abs(x + y - 5), x >= 0, y >= 0], [x, y])

    In the solver, minimize([abs(x - 2) + abs(y + 1) + abs(x + y - 5), x >= 0, y >= 0], [x, y]) gives [4, [x -> 5, y -> 0]].

    Open in the solver
  • min⁡x,y[max⁡(x+y,2x−y,3−x),x≥−5,x≤5,y≥−5,y≤5]=[95,[x→65,y→35]]\displaystyle \min_{x, y} \left[ \max(x+y, 2 x-y, 3-x), x \ge -5, x \le 5, y \ge -5, y \le 5 \right] = \left[ \frac{9}{5}, \left[ x \to \frac{6}{5}, y \to \frac{3}{5} \right] \right]
    minimize([max(x + y, 2x - y, 3 - x), x >= -5, x <= 5, y >= -5, y <= 5], [x, y])

    In the solver, minimize([max(x + y, 2x - y, 3 - x), x >= -5, x <= 5, y >= -5, y <= 5], [x, y]) gives [9/5, [x -> 6/5, y -> 3/5]].

    Open in the solver
  • min⁡x,y[∥[x−1,y−2]∥+∥[x+1,y]∥,x+y≥0]=[22,[x→1,y→2]]\displaystyle \min_{x, y} \left[ \left\| \left[ x-1, y-2 \right] \right\|+\left\| \left[ x+1, y \right] \right\|, x+y \ge 0 \right] = \left[ 2 \sqrt{2}, \left[ x \to 1, y \to 2 \right] \right]
    minimize([norm([x - 1, y - 2]) + norm([x + 1, y]), x + y >= 0], [x, y])

    In the solver, minimize([norm([x - 1, y - 2]) + norm([x + 1, y]), x + y >= 0], [x, y]) gives [2sqrt(2), [x -> 1, y -> 2]].

    Open in the solver
  • min⁡x,y[xy−3x+2y,x≥−2,x≤3,y≥−1,y≤4,[x,y]∈Z]=[−14,[x→3,y→−1]]\displaystyle \min_{x, y} \left[ x y-3 x+2 y, x \ge -2, x \le 3, y \ge -1, y \le 4, \left[ x, y \right] \in \mathbb{Z} \right] = \left[ -14, \left[ x \to 3, y \to -1 \right] \right]
    minimize([x*y - 3x + 2y, x >= -2, x <= 3, y >= -1, y <= 4, [x, y] : integer], [x, y])

    In the solver, minimize([x*y - 3x + 2y, x >= -2, x <= 3, y >= -1, y <= 4, [x, y] : integer], [x, y]) gives [-14, [x -> 3, y -> -1]].

    Open in the solver
  • min⁡x[tan⁡(x),x≥0,x≤2]=[−∞,[x→π2]]\displaystyle \min_{x} \left[ \tan(x), x \ge 0, x \le 2 \right] = \left[ -\infty, \left[ x \to \frac{\pi}{2} \right] \right]
    minimize([tan(x), x >= 0, x <= 2], x)

    In the solver, minimize([tan(x), x >= 0, x <= 2], x) gives [-inf, [x -> pi/2]].

    Open in the solver

Functions its examples use

  • abs

    Absolute value of a number, or modulus of a complex one.

  • max

    The largest of some numbers.

  • norm

    Length of a vector.

  • tan

    Tangent of an angle in radians.

  • numeric_minimize

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

  • numeric_maximize

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

  • min_value

    The minimum value of an expression.

  • maximize

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

  • max_value

    The maximum value of an expression.