Optimising the quadrature rule used in the spectral method when an exact Gaussian quadrature doesn't exist