def _polyder(p, m):
 if (m == 0):
  result = p
 else:
  n = len(p)
  if (n <= m):
   result = np.zeros_like(p[:1, ...])
  else:
   dp = p[:(- m)].copy()
   for k in range(m):
    rng = np.arange(((n - k) - 1), ((m - k) - 1), (-1))
    dp *= rng.reshape((((n - m),) + ((1,) * (p.ndim - 1))))
   result = dp
 return result

def _polyder ( p , m ) : if ( m == 0 ) : result = p else : n = len ( p ) if ( n <= m ) : result = np . zeros_like ( p [ : 1 , ... ] ) else : dp = p [ : ( - m ) ] . copy ( ) for k in range ( m ) : rng = np . arange ( ( ( n - k ) - 1 ) , ( ( m - k ) - 1 ) , ( - 1 ) ) dp *= rng . reshape ( ( ( ( n - m ) , ) + ( ( 1 , ) * ( p . ndim - 1 ) ) ) ) result = dp return result
differentiate polynomials represented with coefficients .