Esempio n. 1
0
def jacobidnorm(N,a,b,d,x):
    """ Return the dth derivative of the [d,N] shifted Jacobi(a,b) polynomials at x
    
        The polynomials are normalised to have weighted L^2 norm 1. (although, obviously
        not the derivatives)
    """
    n = np.arange(N+1, dtype=float)
    norms = np.sqrt((1 /(2*n+a+b+1)) * (sso.poch(n + 1, a) / sso.poch(n + b + 1, a)))
    return jacobid(N,a,b,d,x) / norms
Esempio n. 2
0
    def test_gegenbauer(self):
        a = 5 * np.random.random() - 0.5
        if np.any(a == 0):
            a = -0.2
        Ca0 = orth.gegenbauer(0, a)
        Ca1 = orth.gegenbauer(1, a)
        Ca2 = orth.gegenbauer(2, a)
        Ca3 = orth.gegenbauer(3, a)
        Ca4 = orth.gegenbauer(4, a)
        Ca5 = orth.gegenbauer(5, a)

        assert_array_almost_equal(Ca0.c, array([1]), 13)
        assert_array_almost_equal(Ca1.c, array([2 * a, 0]), 13)
        assert_array_almost_equal(Ca2.c, array([2 * a * (a + 1), 0, -a]), 13)
        assert_array_almost_equal(
            Ca3.c,
            array([4 * orth.poch(a, 3), 0, -6 * a * (a + 1), 0]) / 3.0, 11)
        assert_array_almost_equal(
            Ca4.c,
            array([
                4 * orth.poch(a, 4), 0, -12 * orth.poch(a, 3), 0, 3 * a *
                (a + 1)
            ]) / 6.0, 11)
        assert_array_almost_equal(
            Ca5.c,
            array([
                4 * orth.poch(a, 5), 0, -20 * orth.poch(a, 4), 0,
                15 * orth.poch(a, 3), 0
            ]) / 15.0, 11)
Esempio n. 3
0
    def test_gegenbauer(self):
        a = 5*rand()-0.5
        if np.any(a==0): a = -0.2
        Ca0 = orth.gegenbauer(0,a)
        Ca1 = orth.gegenbauer(1,a)
        Ca2 = orth.gegenbauer(2,a)
        Ca3 = orth.gegenbauer(3,a)
        Ca4 = orth.gegenbauer(4,a)
        Ca5 = orth.gegenbauer(5,a)

        assert_array_almost_equal(Ca0.c,array([1]),13)
        assert_array_almost_equal(Ca1.c,array([2*a,0]),13)
        assert_array_almost_equal(Ca2.c,array([2*a*(a+1),0,-a]),13)
        assert_array_almost_equal(Ca3.c,array([4*orth.poch(a,3),0,-6*a*(a+1),
                                               0])/3.0,11)
        assert_array_almost_equal(Ca4.c,array([4*orth.poch(a,4),0,-12*orth.poch(a,3),
                                               0,3*a*(a+1)])/6.0,11)
        assert_array_almost_equal(Ca5.c,array([4*orth.poch(a,5),0,-20*orth.poch(a,4),
                                               0,15*orth.poch(a,3),0])/15.0,11)
Esempio n. 4
0
def jacobi2d(N,a,b,d,x):
    """ Return the dth derivative of the [d,N] Jacobi(a,b) polynomials at x"""
    from scipy.special.orthogonal import poch
    v = getJacobi(a+d,b+d)(N-d, x)   
    fv = poch(numpy.arange(a+b+d+1, a+b+N+2), d)[:,numpy.newaxis] * v
    return numpy.vstack((numpy.zeros((d, len(x))), fv ))
Esempio n. 5
0
def jacobid(N,a,b,d,x):
    """ Return the dth derivative of the [d,N] shifted Jacobi(a,b) polynomials at x  """
    v = getJacobi(a+d,b+d)(N-d, x)   
    fv = sso.poch(np.arange(a+b+d+1, a+b+N+2), d)[:,np.newaxis] * v

    return np.vstack((np.zeros((d, len(x))), fv )).T