use a more complicated algorithm for erf -- maybe it is technically O(d^2) instead of O(d^3)