harold.haroldpolymul

harold.haroldpolymul(*args, trim_zeros=True)

Simple wrapper around the numpy.convolve() function for polynomial multiplication with multiple args. The arguments are passed through the left zero trimming function first.

Parameters:
  • args (iterable) – An iterable with 1D array-like elements.
  • trim_zeros (bool, optional) – If True, the zeros at the front of the arrays are truncated. Default is True.
Returns:

p (ndarray) – The polynomial coefficients of the product.

Examples

>>> haroldpolymul([0,2,0], [0,0,0,1,3,3,1], [0,0.5,0.5])
array([ 1.,  4.,  6.,  4.,  1.,  0.])