I set up the coordinate system such that lens 1 is at $a$ and lens 2 is at $-a$ which is stupid because the coefficients are simpler when one lens is at the origin. This should speed up the computation of the coefficients and hence the magnification calculation.