parameters: (self, a, b, extrapolate=None)
return_statement: return range_int.reshape(self.c.shape[2:])
docstring: Compute a definite integral over a piecewise polynomial.
  
          Parameters
          ----------
          a : float
              Lower integration bound
          b : float
              Upper integration bound
          extrapolate : {bool, 'periodic', None}, optional
              If bool, determines whether to extrapolate to out-of-bounds points
              based on first and last intervals, or to return NaNs.
              If 'periodic', periodic extrapolation is used.
              If None (default), use `self.extrapolate`.
  
          Returns
          -------
          ig : array_like
              Definite integral of the piecewise polynomial over [a, b]
docstring_summary: Compute a definite integral over a piecewise polynomial.
docstring_tokens: Compute a definite integral over a piecewise polynomial .
function: def integrate(self, a, b, extrapolate=None):
          """
          Compute a definite integral over a piecewise polynomial.
  
          Parameters
          ----------
          a : float
              Lower integration bound
          b : float
              Upper integration bound
          extrapolate : {bool, 'periodic', None}, optional
              If bool, determines whether to extrapolate to out-of-bounds points
              based on first and last intervals, or to return NaNs.
              If 'periodic', periodic extrapolation is used.
              If None (default), use `self.extrapolate`.
  
          Returns
          -------
          ig : array_like
              Definite integral of the piecewise polynomial over [a, b]
          """
          if extrapolate is None:
              extrapolate = self.extrapolate
  
          # Swap integration bounds if needed
          sign = 1
          if b < a:
              a, b = b, a
              sign = -1
  
          range_int = np.empty((prod(self.c.shape[2:]),), dtype=self.c.dtype)
          self._ensure_c_contiguous()
  
          # Compute the integral.
          if extrapolate == 'periodic':
              # Split the integral into the part over period (can be several
              # of them) and the remaining part.
  
              xs, xe = self.x[0], self.x[-1]
              period = xe - xs
              interval = b - a
              n_periods, left = divmod(interval, period)
  
              if n_periods > 0:
                  _ppoly.integrate(
                      self.c.reshape(self.c.shape[0], self.c.shape[1], -1),
                      self.x, xs, xe, False, out=range_int)
                  range_int *= n_periods
              else:
                  range_int.fill(0)
  
              # Map a to [xs, xe], b is always a + left.
              a = xs + (a - xs) % period
              b = a + left
  
              # If b <= xe then we need to integrate over [a, b], otherwise
              # over [a, xe] and from xs to what is remained.
              remainder_int = np.empty_like(range_int)
              if b <= xe:
                  _ppoly.integrate(
                      self.c.reshape(self.c.shape[0], self.c.shape[1], -1),
                      self.x, a, b, False, out=remainder_int)
                  range_int += remainder_int
              else:
                  _ppoly.integrate(
                      self.c.reshape(self.c.shape[0], self.c.shape[1], -1),
                      self.x, a, xe, False, out=remainder_int)
                  range_int += remainder_int
  
                  _ppoly.integrate(
                      self.c.reshape(self.c.shape[0], self.c.shape[1], -1),
                      self.x, xs, xs + left + a - xe, False, out=remainder_int)
                  range_int += remainder_int
          else:
              _ppoly.integrate(
                  self.c.reshape(self.c.shape[0], self.c.shape[1], -1),
                  self.x, a, b, bool(extrapolate), out=range_int)
  
          # Return
          range_int *= sign
          return range_int.reshape(self.c.shape[2:])
function_tokens: def integrate ( self , a , b , extrapolate = None ) : if extrapolate is None : extrapolate = self . extrapolate # Swap integration bounds if needed sign = 1 if b < a : a , b = b , a sign = - 1 range_int = np . empty ( ( prod ( self . c . shape [ 2 : ] ) , ) , dtype = self . c . dtype ) self . _ensure_c_contiguous ( ) # Compute the integral. if extrapolate == 'periodic' : # Split the integral into the part over period (can be several # of them) and the remaining part. xs , xe = self . x [ 0 ] , self . x [ - 1 ] period = xe - xs interval = b - a n_periods , left = divmod ( interval , period ) if n_periods > 0 : _ppoly . integrate ( self . c . reshape ( self . c . shape [ 0 ] , self . c . shape [ 1 ] , - 1 ) , self . x , xs , xe , False , out = range_int ) range_int *= n_periods else : range_int . fill ( 0 ) # Map a to [xs, xe], b is always a + left. a = xs + ( a - xs ) % period b = a + left # If b <= xe then we need to integrate over [a, b], otherwise # over [a, xe] and from xs to what is remained. remainder_int = np . empty_like ( range_int ) if b <= xe : _ppoly . integrate ( self . c . reshape ( self . c . shape [ 0 ] , self . c . shape [ 1 ] , - 1 ) , self . x , a , b , False , out = remainder_int ) range_int += remainder_int else : _ppoly . integrate ( self . c . reshape ( self . c . shape [ 0 ] , self . c . shape [ 1 ] , - 1 ) , self . x , a , xe , False , out = remainder_int ) range_int += remainder_int _ppoly . integrate ( self . c . reshape ( self . c . shape [ 0 ] , self . c . shape [ 1 ] , - 1 ) , self . x , xs , xs + left + a - xe , False , out = remainder_int ) range_int += remainder_int else : _ppoly . integrate ( self . c . reshape ( self . c . shape [ 0 ] , self . c . shape [ 1 ] , - 1 ) , self . x , a , b , bool ( extrapolate ) , out = range_int ) # Return range_int *= sign return range_int . reshape ( self . c . shape [ 2 : ] )