SHARE
TWEET

Untitled

a guest Feb 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def computeDeriv(poly):
  2.     '''
  3.     Computes and returns the derivative of a polynomial function as a list of
  4.     floats. If the derivative is 0, returns [0.0].
  5.  
  6.     poly: list of numbers, length > 0
  7.     returns: list of numbers (floats)
  8.     '''
  9.     f = 0.0
  10.     L=[0.0]
  11.     for i in range(len(poly)):  
  12.         f = float(poly[i] * i)
  13.         if i >= 1:
  14. #            f = (poly[i] * i)
  15.             L.append(f)
  16.     return L
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top