Optimization Functions
maximize(f, var1, var2, ...), minimize(f, var1, var2, ...)—Return values for all the arguments of the objective function f so that the constraints in a solve block are satisfied, and function f takes on its largest or smallest value, respectively.
When the function has one argument only, the solution is a scalar. Otherwise, the solution is a vector where the first element is the solution to var1, the second element is the solution to var2, and so on. PTC Mathcad Prime adjusts all the argument values simultaneously to minimize the error.
f is the objective function to minimize or maximize. You must supply f without its arguments to the solve block function.
var1, var2, ..., are the guess values for each of the arguments of the objective function f. The order in which you enter the guess values must be the same as the argument order for the objective function. When the solve block contains more than one guess value, you must pass all the values as arguments to the maximize or minimize function.
Watch this video to learn more about optimization functions:
Additional Information
For unconstrained function optimization, you can use the maximize and minimize functions outside a solve block. PTC Mathcad Prime ignores constraints that you specify outside solve blocks.
Legacy PTC Mathcad functions Maximize and Minimize are interchangeable with maximize and minimize respectively.
Inserting the lowercase functions from the Ribbon, or manually typing the lower/upper case versions, automatically assigns them the Keyword label.
Functions maximize and minimize use the KNITRO solving algorithm.
The order of the parameters returned by maximize and minimize matches the order of arguments of function f.
When you add constraints to an optimization problem, you must have fewer equality constraints than optimization variables. Otherwise the constraints will usually fix the values of the variables in such a way that there is nothing to optimize. On the other hand, you can have any number of inequality constraints.
Guess values that you provide must satisfy the specified constraint.
Was this helpful?