integrate_piecewise(function,
        x,
        method='romberg',
        return_pieces=False,
        **kwargs)
  
   | source code 
     | 
    
  
  Integrate function and return the integral at a sequence of points. 
Useful when you want to efficiently calculate a cumulative integral. 
Also useful for piecewise-defined functions where discontinuities
or critical points cause quadrature routines to complain or become
inaccurate. 
Integration methods available are: quad, romberg. 
Parameters
- function : callable
 
- User defined function. Should take a single vector argument
and return q vector of the same shape.
 
- x : array_like
 
- Array of points at which to evaluate the integral.
 
- method : str, optional
 
- Name of the method to use to integrate each segment. 'quad' or
'romberg'.
 
- return_pieces : bool, optional
 
- Return the individual segments rather than the sum of all
preceding segments.
 
 
 
Returns
- integral : ndarray
 
- The value of the integral at each x. The first value is always zero.
 
 
 
  
   
 |