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.

- 88,713
- 10
- 131
- 172

- 864
- 1
- 15
- 23
-
1There is no "derivative" implementation in the standard library. You can, of course, *implement your own*. – juanpa.arrivillaga Aug 29 '17 at 20:05
-
Why are you posting this in the comments of this question? If you have another question, start another question. – juanpa.arrivillaga Aug 30 '17 at 17:25
-
Oh sorry I am new over here hence didn't knew. thanks – mozilla-firefox Aug 30 '17 at 17:26
2 Answers
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.

- 221,503
- 14
- 230
- 353
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.

- 342
- 3
- 9