in reply to mathsy question: finding max of curve from discrete points

Without having any more info about the points and their interaction, scientifically speaking, you have to connect the points using straight lines, which, by definition, produces a graph with its maximum on one of such a graph.

With this in mind, you can use the following method to find the maximum point:

This, of course, is an algorithm approximating a derivative, which is what you would want to do to find a maximum of a graph in the first place. However, since, as I've explained, the maximum will have to be on a data point, you should simply be able to sort the data points and get the maximum that way. I hope this helps at least somewhat.

Replies are listed 'Best First'.
Re: Re: mathsy question
by zby (Vicar) on May 07, 2003 at 15:26 UTC
    Heh - a simple sort on the data would be equivalent to that algorithm (if you don't mind being a O log n slower).

    Update: Sorry - you say exactly that in the last sentence.