Re: (newbie) Find Max Number In An Array



On 2006-06-27, Nektarios - Greece <eizo5@xxxxxxxxxxxx> wrote:
Suppose you have a variable X as an input.
The program should calculate Y=2X+3 (for example) for X=X+1 up to
X=X+50 and then find the minimum Y among these 50 Y's (Y1,Y2,Y3,...Y50).

The Y function i used for example (Y=2X+3) is not appropriate 'cause
it's laminar. Anyway, think of a function (no matter what) that it DOES
have ONE minimum in a X-Y graph. Usually, the minimum is at about
X=X+10, but i want to find the exact X for SURE. That's why i need to
calculate up to 'X+50'.

QUESTIONS
---------
Do i have to put each Y to an array [X,Y] and then find the minimum Y ?

No, because the minimum might not be a whole number. Probably you should
either calculate the derivative of the function, and equate that to zero, or
try a numeric solving solution.

This all depends on the border clauses of your problem.

How can i add the (X,Y) pair in an array and find the minimum Y ?

Are you sure you have to do this?

Can i create a graph X-Y in Delphi ?

Yes.
.