## Maximum-Finder Utility for f(M) = a_{1}cos(M)sin^{2}(M) + a_{2}cos^{2}(M)sin^{2}(M) + a_{3}

This page contains a routine that numerically finds a local maximum of the equation presented above on the interval specified by the user. It is written in JavaScript, so make sure that JavaScript is enabled in your browser.

**References:**

Brent, Richard

"Algorithms for Minimization Without Derivatives"

Prentice - Hall, Inc.

1973

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 give this utility some flexibility, the user is given fields into which values can be entered for the *constants* **a**_{1}, **a**_{2}, and **a**_{3}. 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 **a**_{1} and **a**_{2} are 0, but **a**_{3} 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.

Return to Math Functions Page

Return to Thothworks Home Page