Exemple #1
0
def splint(a, b, tck, full_output=0):
    """
    Evaluate the definite integral of a B-spline.

    Given the knots and coefficients of a B-spline, evaluate the definite
    integral of the smoothing polynomial between two given points.

    Parameters
    ----------
    a, b : float
        The end-points of the integration interval.
    tck : tuple
        A tuple (t,c,k) containing the vector of knots, the B-spline
        coefficients, and the degree of the spline (see `splev`).
    full_output : int, optional
        Non-zero to return optional output.

    Returns
    -------
    integral : float
        The resulting integral.
    wrk : ndarray
        An array containing the integrals of the normalized B-splines
        defined on the set of knots.

    See Also
    --------
    splprep, splrep, sproot, spalde, splev
    bisplrep, bisplev
    UnivariateSpline, BivariateSpline

    References
    ----------
    .. [1] P.W. Gaffney, The calculation of indefinite integrals of b-splines",
        J. Inst. Maths Applics, 17, p.37-41, 1976.
    .. [2] P. Dierckx, "Curve and surface fitting with splines", Monographs
        on Numerical Analysis, Oxford University Press, 1993.

    """
    t, c, k = tck
    try:
        c[0][0]
        parametric = True
    except:
        parametric = False
    if parametric:
        return _ntlist(
            map(lambda c, a=a, b=b, t=t, k=k: splint(a, b, [t, c, k]), c))
    else:
        aint, wrk = _fitpack._splint(t, c, k, a, b)
        if full_output: return aint, wrk
        else: return aint
def splint(a,b,tck,full_output=0):
    """
    Evaluate the definite integral of a B-spline.

    Given the knots and coefficients of a B-spline, evaluate the definite
    integral of the smoothing polynomial between two given points.

    Parameters
    ----------
    a, b : float
        The end-points of the integration interval.
    tck : tuple
        A tuple (t,c,k) containing the vector of knots, the B-spline
        coefficients, and the degree of the spline (see `splev`).
    full_output : int, optional
        Non-zero to return optional output.

    Returns
    -------
    integral : float
        The resulting integral.
    wrk : ndarray
        An array containing the integrals of the normalized B-splines
        defined on the set of knots.

    See Also
    --------
    splprep, splrep, sproot, spalde, splev
    bisplrep, bisplev
    UnivariateSpline, BivariateSpline

    References
    ----------
    .. [1] P.W. Gaffney, The calculation of indefinite integrals of b-splines",
        J. Inst. Maths Applics, 17, p.37-41, 1976.
    .. [2] P. Dierckx, "Curve and surface fitting with splines", Monographs
        on Numerical Analysis, Oxford University Press, 1993.

    """
    t,c,k=tck
    try:
        c[0][0]
        parametric = True
    except:
        parametric = False
    if parametric:
        return _ntlist(map(lambda c,a=a,b=b,t=t,k=k:splint(a,b,[t,c,k]),c))
    else:
        aint,wrk=_fitpack._splint(t,c,k,a,b)
        if full_output: return aint,wrk
        else: return aint
Exemple #3
0
def splint(a,b,tck,full_output=0):
    """
    Evaluate the definite integral of a B-spline.

    Given the knots and coefficients of a B-spline, evaluate the definite
    integral of the smoothing polynomial between two given points.

    Parameters
    ----------
    a, b -- The end-points of the integration interval.
    tck -- A length 3 sequence describing the given spline (See splev).
    full_output -- Non-zero to return optional output.

    Returns
    -------
    integral -- The resulting integral.

    wrk -- An array containing the integrals of the
           normalized B-splines defined on the set of knots.

    See Also
    --------
    splprep, splrep, sproot, spalde, splev : evaluation, roots, integral
    bisplrep, bisplev : bivariate splines
    UnivariateSpline, BivariateSpline :
        An alternative wrapping of the FITPACK functions.

    References
    ----------
    .. [1] P.W. Gaffney, The calculation of indefinite integrals of b-splines",
        J. Inst. Maths Applics, 17, p.37-41, 1976.
    .. [2] P. Dierckx, "Curve and surface fitting with splines", Monographs
        on Numerical Analysis, Oxford University Press, 1993.

    """
    t,c,k=tck
    try:
        c[0][0]
        parametric = True
    except:
        parametric = False
    if parametric:
        return _ntlist(map(lambda c,a=a,b=b,t=t,k=k:splint(a,b,[t,c,k]),c))
    else:
        aint,wrk=_fitpack._splint(t,c,k,a,b)
        if full_output: return aint,wrk
        else: return aint
Exemple #4
0
def splint(a,b,tck,full_output=0):
    """Evaluate the definite integral of a B-spline.

    Description:

      Given the knots and coefficients of a B-spline, evaluate the definite
      integral of the smoothing polynomial between two given points.

    Inputs:

      a, b -- The end-points of the integration interval.
      tck -- A length 3 sequence describing the given spline (See splev).
      full_output -- Non-zero to return optional output.

    Outputs: (integral, {wrk})

      integral -- The resulting integral.
      wrk -- An array containing the integrals of the normalized B-splines defined
             on the set of knots.


    See also:
      splprep, splrep, sproot, spalde, splev - evaluation, roots, integral
      bisplrep, bisplev - bivariate splines
      UnivariateSpline, BivariateSpline - an alternative wrapping 
              of the FITPACK functions
    """
    t,c,k=tck
    try:
        c[0][0]
        parametric = True
    except:
        parametric = False
    if parametric:
        return _ntlist(map(lambda c,a=a,b=b,t=t,k=k:splint(a,b,[t,c,k]),c))
    else:
        aint,wrk=_fitpack._splint(t,c,k,a,b)
        if full_output: return aint,wrk
        else: return aint