Entry
Math: Chaos theory:Equation: Logistic:Can you give Delphi program to show Verhulst logistic curve?
Nov 29th, 2003 17:37
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 29 November 2003 - 06:58 pm -------------------
Math: Chaos theory:Equation: Logistic:Can you give Delphi program to
show Verhulst logistic curve?
---
Here a program written in Delphi which uses the Verhulst logistics
equation to show the
bifurcation.
---
Steps: Overview:
1. -Given the Verhulst logistics equation
newpopulation = constant . (oldpopulation) . (1 - oldpopulation)
or thus here:
x = constant * x * (1 - x)
2. -You use the algorithm
for first to last value of the constant
for first to last generation
calculate the new population
draw a dot at XY position
(parameter, population)
on the screen
next generation
next constant
---
Note:
To possibly see it a bit easier, as less dots are involved,
you could use the following algorithm, which only shows
the last generation
for first to last value of the constant
let the population grow for a while
(e.g. until the first thousand populations)
when finished draw a dot at position
(parameter, population) on the screen
3. -A possible program to implement this could be:
1. Put a button on an empty form.
2. Double click on this button
3. In the OnClick event write the following extra lines:
--- cut here ---------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var I : integer;
var parameterI : integer;
var x : double;
var parameter : double;
begin
// vary the constant from 0 to 4
for parameterI := 0 to 400 do begin
parameter := parameterI / 100;
// you choose (arbitrarily) your starting population half of total
x := 0.5;
// you first calculate the first (arbitrary) thousand generations
for I := 1 TO 1000 do begin
// this is just the Verhulst logical equation 'constant . x . (1-x)'
x := parameter * x * ( 1 - x );
// draw dot at transformed XY screen position (parameter, x)
Canvas.Pixels[ Round( 100 * parameter ), 200 - Round( 100 * x ) ] :=
clBlack;
end;
// possible check the x,y values
// ShowMessage( Format( '%f %f', [ parameter, x ] ) );
end;
end;
--- cut here ---------------------------------------------------------
4. When you run this program, you will see a graphical screen with
output similar to the following:
.
. .
.
^ . .
| . . . .
x . . . . .
. . .
. .
...
------------------------------------
| | | |
0 1 3 3.45 ---> parameter
---
It shows only 1 branch of the bifurcated curve.
---
---
Internet: see also:
---
Math: Chaos theory: Overview: Can you give me an overview of chaos
theory?
http://www.faqts.com/knowledge_base/view.phtml/aid/26929/fid/867
---
Delphi: Graphics: Overview: Can you give me an overview of graphics?
http://www.faqts.com/knowledge_base/view.phtml/aid/26976/fid/175
----------------------------------------------------------------------