Minimizing or Maximizing a Function |
Minimize(f, var1, var2, ...)
Maximize(f, var1, var2, ...)
Return the values of var1, var2... that satisfy the constraints in a Solve Block, and make the function f (var1, var2, ...) take on its smallest or largest value, respectively. Minimize and Maximize differ from Find and Minerr in that they refer to functions defined outside of the Solve Block, rather than defined in the body of the Block. Functions are used as objective functions, rather than as constraints, as they are with Find and Minerr. If you are solving for n variables, the solve block must have n equations. The functions choose an appropriate method from a group of available methods, depending on whether the problem is linear or nonlinear, and other attributes.
Equations: Equations to be solved must be defined using Boolean equals. Values in the equations and guess values may be defined within the body of the block using :=.
Constraints: Inequality constraints, using Boolean operators, are allowed.
If the solved variables have different units, they may only be assigned to an explicit vector of names, to avoid mixed units in matrices.