1. A method of optimizing in an optical system that has a laser, at least one measure of an optical output from the optical system that is a quadratic function of a wavefunction, the method comprising: superimposing a plurality of wavefunctions; determining a relationship between the superimposed wavefunctions and the quadratic measure; identifying, using a computer processor, the superimposed wavefunctions that provide a desired or optimized quadratic optical measure using the determined relationship; and generating, using light from the laser and at least one optical component, the identified superimposed wavefunctions that provide the desired or optimized quadratic optical measure.