Re: (newbie) Find Max Number In An Array



Marco van de Voort wrote:
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.

The final function is more complicated. The function i used above is just a sample example. The real function is Y(x1,x2,x3,x4,x5,x). :)
But for known x1,x3,x3,x4,x5 i want for one X to find Y value.
I used Excel but then i can SEE the minimum in the graph. The problem is that i want to do the same thing in Delphi.

.



Relevant Pages

  • Re: Console application help
    ... >> Marco van de Voort wrote: ... >>> what you mean with DJGPP, it applies to FPC's DOS port. ...
    (comp.lang.pascal.misc)
  • Re: Delphi bug? oddity?
    ... >> Marco van de Voort wrote in message ... ... >> Is this limited to method variables, or does the question remain the ... It turns out that the behaviour of assigning is quite simple, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Marco van de Voort the great
    ... > My name is Marco van de Voort ... > my posts you cannot thwart, ...
    (comp.lang.pascal.borland)
  • Re: Marco van de Voort the great
    ... > My name is Marco van de Voort ... > I am the biggest ship in this port, ... Robert AH Prins ...
    (comp.lang.pascal.borland)
  • Marco van de Voort the great
    ... My name is Marco van de Voort ... I am the biggest ship in this port, ...
    (comp.lang.pascal.borland)