Efficient Second Harmonic Distortion Calculation