Maximum-Finder Utility for

f(M)   =   a1cos(M)sin2(M)   +   a2cos2(M)sin2(M)   +   a3


This page contains a routine that numerically finds a local maximum of the equation presented above on the interval specified by the user.


Brent, Richard
          "Algorithms for Minimization Without Derivatives"
          Prentice - Hall, Inc.

The utility posted on this page is based on the NETLIB sub-program FMIN, which is a slightly modifed version of the ALGOL 60 procedure LOCALMIN written by Richard Brent (cited above). FMIN was written in FORTRAN and has been translated to Javascript here. Although all care has been taken to ensure that the sub-routine was translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routine has been thoroughly tested and works properly. Please report any errors to the webmaster.

To increase the flexibility of this utility, the user is given fields into which values can be entered for the constants a1, a2, and a3. If any of the three terms in this equation is not required, just enter 0's for the appropriate a constant(s).

In addition to the a values, the user must enter a range, [b, c], over which a local maximum will be sought for this function. These values represent time variables, from which M is calculated as M = (2πt)/T. T is the period of the motion, which must be entered by the user as well.

The user should ensure that a local maximum is included on this interval before entering these values. Otherwise, the result may be meaningless. The user must try again, entering b and c values such that a local maximum is contained on the interval.

Even before using this utility, an observation may be made:
If a1 and a2 are 0, but a3 is non-zero, the function is a straight line; its maximum is the constant value of the function itself.

Enter the a values for the function.
a1: a2: a3:

Enter the interval, [b, c], over which a local maximum will be sought. Also enter T, the period of the motion. Then click the "Find Maximum" button.
b: c: T:

Square Root of Machine Epsilon

The local maximum on the specified interval occurs at (this result is on the order of the square root of the Machine Epsilon):
t   =  
At this time, the value taken by the function is:
f   =  

Return to Math Functions Page Home