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
minimize(x^2 - 2x, x)In the solver,
Open in the solverminimize(x^2 - 2x, x)gives[-1, [x -> 1]].minimize(x^4 + y^4 - 4x*y + 1, [x, y])In the solver,
Open in the solverminimize(x^4 + y^4 - 4x*y + 1, [x, y])gives[-1, [x -> 1, y -> 1]].minimize([x + y, x + 2y >= 4, 3x + y >= 6, x >= 0, y >= 0], [x, y])In the solver,
Open in the solverminimize([x + y, x + 2y >= 4, 3x + y >= 6, x >= 0, y >= 0], [x, y])gives[14/5, [x -> 8/5, y -> 6/5]].minimize([2x + 3y, x + y >= 7/2, x - y <= 1, x >= 0, y >= 0, [x, y] : integer], [x, y])In the solver,
Open in the solverminimize([2x + 3y, x + y >= 7/2, x - y <= 1, x >= 0, y >= 0, [x, y] : integer], [x, y])gives[10, [x -> 2, y -> 2]].minimize([abs(x - 2) + abs(y + 1) + abs(x + y - 5), x >= 0, y >= 0], [x, y])In the solver,
Open in the solverminimize([abs(x - 2) + abs(y + 1) + abs(x + y - 5), x >= 0, y >= 0], [x, y])gives[4, [x -> 5, y -> 0]].minimize([max(x + y, 2x - y, 3 - x), x >= -5, x <= 5, y >= -5, y <= 5], [x, y])In the solver,
Open in the solverminimize([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]].minimize([norm([x - 1, y - 2]) + norm([x + 1, y]), x + y >= 0], [x, y])In the solver,
Open in the solverminimize([norm([x - 1, y - 2]) + norm([x + 1, y]), x + y >= 0], [x, y])gives[2sqrt(2), [x -> 1, y -> 2]].minimize([x*y - 3x + 2y, x >= -2, x <= 3, y >= -1, y <= 4, [x, y] : integer], [x, y])In the solver,
Open in the solverminimize([x*y - 3x + 2y, x >= -2, x <= 3, y >= -1, y <= 4, [x, y] : integer], [x, y])gives[-14, [x -> 3, y -> -1]].minimize([tan(x), x >= 0, x <= 2], x)In the solver,
Open in the solverminimize([tan(x), x >= 0, x <= 2], x)gives[-inf, [x -> pi/2]].
Functions its examples use
Related functions
- 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.