Volume 9, Issue 4 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff and Contributors Submissions Subscriptions Advertising Back Issues Contact Information 
Tricks of the Trade
Using Reduce To Solve The KuhnTucker EquationsFrank J. Kampas The functions Maximize and Minimize give exact solutions to simple nonlinear optimization problems with equality and inequality constraints. Another approach is to set up Lagrange multipliers for equality constraints and the KuhnTucker equations for inequality constraints (see mathworld.wolfram.com/KuhnTuckerTheorem.html) and solve using Reduce. In some cases, this approach can solve problems which cannot directly be solved with Maximize and Minimize. The following function demonstrates this approach.
Here is an example with an equality constraint in which both the maximum and minimum are obtained. Defining the objective function with a constraint and listing it first in the list of variables places the objective function first in the results.
Equivalent results are obtained by using Maximize and Minimize.
KuhnTucker can solve the problem when the righthand side of the constraint is changed from a number to a symbol.
Maximize and Minimize give an error message in this situation.
In the following example, the constraint is only active if is less than 1. Therefore, the solution obtained covers and separately.
When the solution is degenerate, all the results can be obtained.
The following problem can be solved quite easily if the objective function is not defined as a constraint. Adding the extra constraint greatly increases the solution time. The problem cannot be solved by Minimize or NMinimize unless a change of variables is used to eliminate the square roots.
Using Reduce with domain specified eliminates complex solution candidates.
Note, however, that using Lagrange multipliers and the KuhnTucker equations relies on assumptions that the code does not check. For instance, the solution set of equational constraints should be a manifold of dimension , where is the number of variables and is the number of equations. If this is not satisfied, KuhnTucker may not find the extremum.
Maximize and Minimize work in this situation.


About Mathematica  Download Mathematica Player © Wolfram Media, Inc. All rights reserved. 