def lpol2index(ar):
 ar = np.asarray(ar)
 index = np.nonzero(ar)[0]
 coeffs = ar[index]
 return (coeffs, index)

def lpol2index ( ar ) : ar = np . asarray ( ar ) index = np . nonzero ( ar ) [ 0 ] coeffs = ar [ index ] return ( coeffs , index )
remove zeros from lagpolynomial .