示例#1
0
def splint(a,b,tck,full_output=False):
    """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 -- True 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] # check if c is >1-d
        parametric = True # it is
    except TypeError: parametric = False # c is 1-d
    if parametric:
        return map(lambda c,a=a,b=b,t=t,k=k:splint(a,b,[t,c,k]),c)
    else:
        c = c.copy()
        c.resize(len(t))
        aint,wrk = dfitpack.splint(t,c,k,a,b)
        if full_output: return aint,wrk
        else: return aint
示例#2
0
 def integral(self, a, b):
     """ Return definite integral of the spline between two given points.
     """
     return dfitpack.splint(*(self._eval_args + (a, b)))
示例#3
0
 def integral(self, a, b):
     """ Return definite integral of the spline between two
     given points.
     """
     iy, wrk = dfitpack.splint(*(self._eval_args + (a, b)))
     return iy