LagrangeMultiplierTests
Lagrange multipliers are a method for finding extrema of a function f(x) subject to equality constraints g_i(x) = 0. The idea is to introduce auxiliary variables, called Lagrange multipliers, one for each constraint, and to form the Lagrangian L(x, λ) = f(x) + sum_i λ_i g_i(x). Under regularity conditions, a constrained extremum occurs at points where the gradient of the Lagrangian with respect to x vanishes while the constraints hold.
The standard procedure is to form the Lagrangian and then solve the system given by the stationarity
A simple example is maximizing f(x, y) = xy subject to the constraint x^2 + y^2 = 1. The
Extensions include inequality constraints via the Karush–Kuhn–Tacker (KKT) conditions, which add nonnegativity and complementary slackness. Lagrange