Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement