We present a new method for the design of MRI main magnets, based on a
variational approach with constraints introduced by Lagrange multipli
ers. The extrema are located with a combination of analytical and nume
rical techniques. This method has been tested in the design of nonshie
lded and actively-shielded magnets. Several representative designs are
given. The method is very flexible, having been applied also to the i
nvestigation of gradient coils, and could be adapted to the design of
other static and quasi-static field systems. It may also be used to co
nsider alternate geometries.