stepthom / math-fun

Just testing out some fun with mathematics.
2 stars 2 forks source link

Find the minimum and maximum values of a function #36

Closed stepthom closed 10 years ago

stepthom commented 11 years ago

Implement a way to optimize (i.e., find the global maximum and minimum) a function. This should probably be in the form of two new functions in MathFunction:

-findMaximum(double a, double b) -findMinimum(double a, double b)

These functions should find the maximum and minimum values, respectively, of the function between points a and b, inclusively.

There are many ways to solve this problem; see Wikipedia for a brief discussion:

http://en.wikipedia.org/wiki/Mathematical_optimization

There might be a better resource online.

I'm looking for a solution that:

EasyMain can just set a=-50 and b=50 for now. Thus, the min and max value between -50 and 50 will be printed.