Add the maths for the SQP method.