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?
Take the 2-minute tour
×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.
Python - 202 Bytes
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 Functions D - Calculates the derivative 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
|
|||||||||||||||||
|
[-12, 0, 0, 4, 0, 0, 6]
? – DLosc May 26 at 5:49