On Thu, Mar 28, 2013 at 8:17 AM, <zingbagbam...@gmail.com> wrote: > How do I differentiate(first order and 2nd order) the following equations in > python. I want to differentiate C wrt Q. > > C = (Q**3)-15*(Q**2)+ 93*Q + 100
""" Years ago, when I actually worked for a living, I would have done something like this: """ coeffs = [1, -15, 93, 100] num_coeffs = len(coeffs)-1 deriv = [coeffs[i]*(num_coeffs-i) for i in range(num_coeffs)] print(deriv) """ The above is somewhat obscure and requires one to add some documentation. Who wants to do that? Below is a version using numpy. You get the numpy docs for free. """ import numpy as np p = np.poly1d(coeffs) deriv_np = np.polyder(p) print(deriv_np) # or print(list(deriv_np)) -- http://mail.python.org/mailman/listinfo/python-list