Beispiel #1
0
def gq(N,mu=0.,shift=0.,scale=1.):
    from spyctral.hermite.coeffs import recurrence_range
    from spyctral.opoly1d.quad import gq as ogq
    from spyctral.common.maps import physical_scaleshift as pss

    [a_s,b_s] = recurrence_range(N,mu)
    [x,w] = ogq(a_s,b_s)
    pss(x,scale=scale,shift=shift)
    w *= scale
    return [x,w]
Beispiel #2
0
def gauss_quadrature(N, alpha=0.0, shift=0.0, scale=1.0):
    """
    Returns the N-point Laguerre-Gauss(alpha) quadrature rule over the interval
    (shift,inf).  The quadrature rule is *not* normalized in the sense
    that the affine parameters shift and scale are built into the new weight
    function for which this quadrature rule is valid.
    """

    from spyctral.laguerre.coeffs import recurrence_range
    from spyctral.opoly1d.quad import gq as ogq
    from spyctral.common.maps import physical_scaleshift as pss

    [a, b] = recurrence_range(N, alpha)
    temp = ogq(a, b)
    pss(temp[0], scale=scale, shift=shift)
    return temp
Beispiel #3
0
def gauss_quadrature(N,alpha=-1/2.,beta=-1/2.,shift=0.,scale=1.) : 
# Returns the N-point Jacobi-Gauss(alpha,beta) quadrature rule over the interval
# (-scale,scale)+shift.
# The quadrature rule is *not* normalized in the sense that the affine parameters
# shift and scale are built into the new weight function for which this
# quadrature rule is valid.

    from coeffs import recurrence_range
    from spyctral.opoly1d.quad import gq as ogq
    from spyctral import chebyshev
    from spyctral.common.maps import physical_scaleshift as pss

    tol = 1e-12;
    if (abs(alpha+1/2.)<tol) & (abs(beta+1/2.)<tol) :
        return chebyshev.quad.gq(N,shift=shift,scale=scale)
    else :
        [a,b] = recurrence_range(N,alpha,beta)
        temp = ogq(a,b)
        pss(temp[0],scale=scale,shift=shift)
        return temp