Minimum of a Polynomial in Python What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is the shortest way to do this? For example, if 6x6 + 4x3-12 is entered (ignore parsing issues), what would be the shortest amount of code to find the minimum value?
Python - 202 Bytes



D=lambda p:[i*p[i]for i in range(1,len(p))]
A=lambda p,x:p&gt;[]and p[0]+x*A(p[1:],x)
def N(p):f=D(p);s=D(f);x=1.;y=-x;exec'x-=A(f,x)/A(s,x);y-=A(f,y)/A(s,y);'*99;return A(p,x),A(p,y)
print min(N(input()))


11 bytes saved due to @xnor.

Input is taken from stdin, and is expected to be in the following format: [x0, x1, x2, ...]. For example, the sample in the problem description would be entered as [-12, 0, 0, 4, 0, 0, 6].



Functions

D - Calculates the derivative of a polynomial p.
A - Applies a polynomial p to the value x.
N - Uses Newton's Method to calculate local minima/maxima of a polynomial p.

Note: For higher order polynomials, there may be several local minima. In these cases, this function is not guaranteed to find the global minimum.



Sample Usage

$ echo [-12, 0, 0, 4, 0, 0, 6] | python poly-min.py
-12.6666666667