Esempio n. 1
0
def gauss_radau_quadrature(N, alpha=0.0, r0=None, shift=0.0, scale=1.0):
    """
    Returns the N-point Laguerre-Gauss-Radau(alpha) quadrature rule over
    the interval (shift,inf) For nontrivial values of shift, scale, the
    weight function associated with this quadrature rule is the directly-mapped
    Laguerre weight + the Jacobian factor introduced by scale.
    """

    from numpy import array
    from spyctral.laguerre.coeffs import recurrence_range
    from spyctral.opoly1d.quad import grq as ogrq
    from spyctral.common.maps import physical_scaleshift as pss
    from spyctral.common.maps import standard_scaleshift as sss

    if r0 is None:
        r0 = 0 + shift

    r0 = array(r0)

    [a, b] = recurrence_range(N, alpha)
    sss(r0, scale=scale, shift=shift)
    temp = ogrq(a, b, r0=r0)
    pss(r0, scale=scale, shift=shift)
    pss(temp[0], scale=scale, shift=shift)
    return temp
Esempio n. 2
0
def gauss_radau_quadrature(N,alpha=-1/2.,beta=-1/2.,r0=None,shift=0.,scale=1.) : 
# Returns the N-point Jacobi-Gauss-Radau(alpha,beta) quadrature rule over the interval
# (-scale,scale)+shift
# For nontrivial values of shift, scale, the weight function associated with
# this quadrature rule is the directly-mapped Jacobi weight + the Jacobian
# factor introduced by scale.

    from numpy import array
    from coeffs import recurrence_range
    from spyctral.opoly1d.quad import grq as ogrq
    from spyctral import chebyshev
    from spyctral.common.maps import physical_scaleshift as pss
    from spyctral.common.maps import standard_scaleshift as sss

    if r0 is None:
        r0 = [-scale+shift]

    r0 = array(r0)

    tol = 1e-12;
    if (abs(alpha+1/2.)<tol) & (abs(beta+1/2.)<tol) & (abs(abs(r0)-1.)<tol) :
        return chebyshev.quad.grq(N,r0=r0,shift=shift,scale=scale)
    else :
        [a,b] = recurrence_range(N,alpha,beta)
        sss(r0,scale=scale,shift=shift)
        temp = ogrq(a,b,r0=r0)
        pss(r0,scale=scale,shift=shift)
        pss(temp[0],scale=scale,shift=shift)
        return temp
Esempio n. 3
0
def grq(N,mu=0.,r0=0.,shift=0,scale=1) : 
    from spyctral.hermite.coeffs import recurrence_range
    from spyctral.opoly1d.quad import grq as ogrq
    from spyctral.common.maps import physical_scaleshift as pss

    [a_s,b_s] = recurrence_range(N,mu)
    [x,w] = ogrq(a_s,b_s,N)
    pss(x,shift=shift,scale=scale)
    w *= scale
    return [x,w]