| (5.39) |
In many other cases, it is natural to incorporate desired constraints into the functions used for the fit, and this is usually the easiest approach when it is possible. Other examples are the use of Lagrange polynomials to force polynomial expansions to particular defined values, or the use of solutions to the governing differential equations to fit fields known to be constrained by those equations.
In cases where the constraint cannot be incorporated so simply, there
is a powerful general method for incorporating constraints, the method
of Lagrange multipliers. For example, it may be necessary to constrain
a fit so that at specified values of the (multidimensional) parameters
the function has specified values
:
| (5.40) |
Examples where such constraints are applicable include:
| (5.41) |
The total derivative of the
function must be zero at the solution:
![]() |
(5.42) |
If the infinitesimal increments daj are all independent,
| (5.43) |
as before. However, (5.41) requires that not all the variations daj be independent; the L relationships among the parameters reduce the number of independent parameters to (J-L).
The method of Lagrange multipliers involves the introduction of L
new parameters
.
Multiply the constraining equations (5.41) by these
new parameters and add the total derivative of the result to the minimization
equation (5.42):
![]() |
(5.44) |
This equation is valid for arbitrary
,
so the Lagrange multipliers can be selected to satisfy the L equations
| (5.45) |
The first J of the parameters
can then be considered as independent, so
| (5.46) |
These J-L equations and the L equations (5.45)
are J simultaneous equations to be solved for the J-L
independent parameters
and the L Lagrange multipliers
.
| (5.47) |
Minimization of this function with respect to
,
,
and
would give the best-fit values
,
,
and
.
However, we know that the sum of the angles must be 180
,
and this fit does not necessarily satisfy this constraint.
To incorporate the constraint, define the constraining function
| (5.48) |
The equations to be solved are then
| (5.49) |
where
is any of the angles (
,
,
or
).
We then obtain four equations from which to determine the three best-fit
angles and the Lagrange multiplier
:
| (5.50) |
| (5.51) |
| (5.52) |
| (5.53) |
The solution for the Lagrange multiplier is
| (5.54) |
a value that determines how much the fit must be adjusted from the unconstrained result to enforce the constraint. Notice that the result is that each angle is adjusted by an amount proportional to the square of the measurement uncertainty in that angle. If all angles are measured with the same accuracy, the result is that the adjustment required to enforce the constraint is applied to each angle equally. The final result is
| (5.55) |
| (5.56) |
| (5.57) |
The NCAR Advanced Study Program
http://www.asp.ucar.edu