def testOrthogonal(self): N = 4 MaxAB = 4 x,w = puq.legendrequadrature(N + MaxAB) x = x.ravel() n = np.arange(N, dtype = float) for a in range(MaxAB): for b in range(MaxAB): # first lets test some orthogonality: P = pup.jacobidnorm(N-1, a, b, 0, x) # get the first N jacobi polynomials evaluated at x jw = w * x**b * (1-x)**a # combine quadrature weight with orthogonality weight PP = np.dot(P.T * jw, P) # norm2 = (1 /(2*n+a+b+1)) * (sso.poch(n + 1, a) / sso.poch(n + b + 1, a)) # np.testing.assert_almost_equal(PP, np.diag(norm2)) np.testing.assert_almost_equal(PP, np.eye(N,N))
def laplacian(self, x): return pup.jacobidnorm(self.n-1, 0,0,2, x.ravel())
def derivs(self, x): vals=pup.jacobidnorm(self.n-1,0,0,1,x.ravel()) return vals[...,np.newaxis]
def values(self, x): return pup.jacobidnorm(self.n-1,0,0,0,x.ravel())