Mathematical technique quickly tunes next-generation lenses