Convergence test now working. Linear test not quite machine precision. Changed code to use X and Y functions defined as described in the lyx file