math - How do I efficiently find the maximum value in an array containing values of a smooth function? -


I have a function that takes floating point number and gives a floating point number It can be assumed that if you If you want to graph the output of this function, it will be 'N' size, i.e. There will be a maximum point, and there will be no other point on the function with zero slope. We also know that the input output which produces this maximum output will be between two known points, probably 0.0 and 1.0.

I should get input value from efficient value which gives some approximate approximation value to the maximum output value, without searching without it.

I am looking for something that is rooted in the function, but since my work is opaque, I can not get it.

I want to subtract all the other answers so far for various reasons, but I do not.

Derivatives are not available when writing an algorithm is a classic and efficient method for reducing (or maximizing) smooth functioning, so it is temporarily a golden-section search (Brent's Minimizer), when the parabolic projection does not progress rapidly in the form of a golden section.

Did I write such an algorithm in C ++ Any proposal?

UPDATE : There is a version of Brent Minimizer in GSL archives here: Note that this is GNU "Copyth." Will be covered with some taste.

As I wrote it, the latest-and-greatest GSL-1.14.TTGG appears The minimizer file is located in GSL-1 1.14 / minute / Brent C. It seems that the closing criterion I applied was similar to that. I have not studied how it decides to switch to the golden section, but for OP, this is probably the case.

Update 2 : I translated a public domain Java version, from Fortran I can not guarantee for its quality. I have noticed that hard working machine efficiency < / Em> ("Machine Precision" in the comment) today is 1/2 the value for a specific PC Change the value of EPS to 2.22045 -16


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -