Is there a method to perform a derivative by inbuilt function in python 3.5?

668 views Asked by At

I don't want to use numpy because it isn't permitted in competitive programming.I want to take derivative of for instance m=a(a**2-24a).
Now,a=0 and a=8 are critical points. I want to find this value.Is it possible by using any python library function excluding numpy.

2

There are 2 answers

0
hpaulj On BEST ANSWER

m=a(a**2-24a) does not make sense as a Python expression, regardless of what a is. The first a( implies a function; a** implies a number, and 24a is I-don't-know-what.

Derivative is a mathematical concept that's implemented in sympy (symbolic math). numpy also implements it for polynomials. numpy also implements a finite difference approximation for arrays.

For a list of numbers (or two lists) you could calculate a finite difference approximation (without numpy).

But for a general function, there isn't a derivative method for Python nor numpy.

Your question might make more sense if you give examples of the function or lists that you are working with.

0
Dodger On

You can check the implementation in the numpy repository and use that information to implement your own version. You should start with polyder. Probably you do not need half of the code in their implementation.