----------------------------------------------------------------------
--- Knud van Eeden --- 24 February 2008 - 02:43 pm -------------------
Language: Computer: Borland: Delphi: Graphics: Draw: Mathematics: Hexstat: Graph: Create: How to
===
Steps: Overview:
1. -Put a button on the form
2. -Double click on the button
3. -E.g. create the following program:
--- cut here: begin --------------------------------------------------
var
trialMinI : integer;
trialMaxI : integer;
stepMinI : integer;
stepMaxI : integer;
ymaxI : integer;
yScreenMaxI: integer;
x : array[1..640 + 1 + 640] of integer;
x0 : integer;
trialI : integer;
stepI : integer;
yI : integer;
begin
trialMinI := 1;
trialMaxI := 100000;
stepMinI := 1;
stepMaxI := 640;
yMaxI := -999999;
yScreenMaxI := 800;
Randomize;
for stepI := stepMinI TO stepMaxI + 1 + stepMaxI do begin
x[ stepI ] := 0;
end;
for trialI := trialMinI TO trialMaxI do begin
x0 := stepMaxI + 1;
for stepI := stepMinI TO stepMaxI do begin
if ( Random( 2 ) = 1 ) then begin
x0 := x0 + 1
end
else begin
x0 := x0 - 1;
end;
end;
x[ x0 ] := x[ x0 ] + 1;
end;
for stepI := stepMinI TO stepMaxI + 1 + stepMaxI do begin
if ( yMaxI < x[ stepI ] ) then begin
yMaxI := x[ stepI ];
end;
end;
for stepI := stepMinI TO stepMaxI + 1 + stepMaxI do begin
Form1.Canvas.MoveTo( stepI, 0 );
Form1.Canvas.LineTo( stepI, Round( ( x[ stepI ] / yMaxI ) * yScreenMaxI ) );
end;
Canvas.Pen.Color := clRed;
Form1.Canvas.MoveTo( stepmaxI + 1, 0 );
Form1.Canvas.LineTo( stepMaxI + 1, yScreenMaxI );
Canvas.Pen.Color := clBlack;
--- cut here: end ----------------------------------------------------
4. -Run the program
5. -That will show a screen output similar to the graph
===
Screencast: see also:
===
Image: see also:
===
Program: see also:
01.exe
===
Video: see also:
===
Internet: see also:
Mathematics: Probability: Distribution: Binomial: Hexstat: Links: Can you give an overview of links?
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000123
----------------------------------------------------------------------