def setUp(self): npts = 15 self.xk = Chebtech2._chebpts(npts) self.vk = Chebtech2._barywts(npts) self.fk = np.random.rand(npts) self.ak = np.random.rand(11) self.xx = -1 + 2*np.random.rand(9) self.pts = -1 + 2*np.random.rand(1001)
def setUp(self): npts = 15 self.xk = Chebtech2._chebpts(npts) self.vk = Chebtech2._barywts(npts) self.fk = np.random.rand(npts) self.ak = np.random.rand(11) self.xx = -1 + 2 * np.random.rand(9) self.pts = -1 + 2 * np.random.rand(1001)
def evalTester(method, fun, evalpts, chebpts): x = evalpts xk = chebpts fvals = fun(xk) if method is bary: vk = Chebtech2._barywts(fvals.size) a = bary(x, fvals, xk, vk) tol_multiplier = 1e0 elif method is clenshaw: ak = Chebtech2._vals2coeffs(fvals) a = clenshaw(x, ak) tol_multiplier = 2e1 b = fun(evalpts) n = evalpts.size tol = tol_multiplier * scaled_tol(n) return infNormLessThanTol(a, b, tol)