コード例 #1
0
ファイル: matrices.py プロジェクト: cygnine/spyctral
def stiff_overhead(N,alpha=-1/2.,beta=-1/2.,scale=1.):
    from jfft import rmatrix_entries
    from numpy import arange
    from coeffs import zetan

    zetas = zetan(arange(N),alpha=alpha,beta=beta)/scale
    Rs = rmatrix_entries(N-1,alpha,beta,1,1)
    return [zetas[1:],Rs]
コード例 #2
0
ファイル: eval.py プロジェクト: cygnine/spyctral
def jacobi_polynomial_derivative(x,n,alpha=-1/2.,beta=-1/2.,normalization='normal',scale=1.,shift=0.):
    """
    Evaluates the derivative of the Jacobi polynomial with specified
    normalization. Although this is possible using jacobi_polynomial, this
    function evaluates the polynomial of order (alpha+1,beta+1) and scales it
    accordingly. 
    """
    from coeffs import zetan
    from numpy import array
    zetas = zetan(array(n),alpha=alpha,beta=beta,normalization=normalization)/scale
    return jacobi_polynomial(x,array(n)-1,alpha+1.,beta+1.,normalization=normalization,\
                 shift=shift,scale=scale)*zetas
コード例 #3
0
ファイル: matrices.py プロジェクト: cygnine/spyctral
def stiff_apply(F,alpha=-1/2.,beta=-1/2.,scale=1.):
    """
    Applies the modal stiffness matrix to the coefficients of the L2 normalized
    polynomials. Makes use of the recurrence constant zetan in addition to the
    sparse representation of the connection coefficients Is an O(N) operation
    """

    from jfft import rmatrix_invert
    from numpy import arange,hstack, array
    from coeffs import zetan

    N = F.size
    # Input F is of class (alpha,beta). Take the derivative by promoting
    # basis functions to (alpha+1,beta+1) using zetan:
    zetas = zetan(arange(N),alpha=alpha,beta=beta)/scale

    # Now demote the (alpha+1,beta+1) coefficients back down to
    # (alpha,beta)
    filler = array([0.])
    return hstack((rmatrix_invert(zetas[1:]*F[1:],alpha,beta,1,1),filler))