unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, Buttons;
type
TForm1 =
class
(TForm)
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
Chart1: TChart;
Chart2: TChart;
Chart3: TChart;
Series1: TPointSeries;
Series2: TPointSeries;
Series3: TPointSeries;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure
BitBtn1Click(Sender: TObject);
procedure
BitBtn2Click(Sender: TObject);
procedure
Chart1DblClick(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
l,w:
double
;
implementation
{$R *.dfm}
function
dx(x,y:
double
):
double
;
begin
result:=y;
end
;
function
dy(x,y:
double
):
double
;
begin
result:=(l-x*x)*y-w*w*x;
end
;
procedure
runge(
var
x,y:
double
);
const
dh=
0.05
;
var
k1,k2,k3,k4,
l1,l2,l3,l4,
q1,q2,q3,q4:
double
;
begin
k1:=dx(x,y);
l1:=dy(x,y);
k2:=dx(x+dh*k1/
2
,y+dh*q1/
2
);
l2:=dy(x+dh*k1/
2
,y+dh*q1/
2
);
k3:=dx(x+dh*k2/
2
,y+dh*q2/
2
);
l3:=dy(x+dh*k2/
2
,y+dh*q2/
2
);
k4:=dx(x+dh*k3,y+dh*q3);
l4:=dy(x+dh*k3,y+dh*q3);
x:=x+dh*(k1+
2
*k2+
2
*k3+k4)/
6
;
y:=y+dh*(l1+
2
*l2+
2
*l3+l4)/
6
;
end
;
procedure
TForm1
.
BitBtn1Click(Sender: TObject);
var
t_stop,time,x,y:
double
;
begin
Chart1
.
Series[
0
].Clear;
l:=StrToFloat(LabeledEdit1
.
Text);
w:=StrToFloat(LabeledEdit2
.
Text);
t_stop:=
30000
;
While
l<
5
do
begin
x:=
0.1
;
y:=
0.1
;
time:=
0
;
While
time<t_stop
do
begin
runge(x,y);
if
time>
25000
then
Chart1
.
Series[
0
].AddXY(l,x);
time:=time+
1
;
end
;
l:=l+
0.1
;
end
;
end
;
procedure
TForm1
.
BitBtn2Click(Sender: TObject);
begin
halt;
end
;
procedure
TForm1
.
Chart1DblClick(Sender: TObject);
var
x,z,y,t_stop1,time1:
double
;
begin
Chart2
.
Series[
0
].Clear;
Chart3
.
Series[
0
].Clear;
Chart1
.
Series[
0
].GetCursorValues(l,x);
z:=
0.1
;
y:=
0.1
;
t_stop1:=
2000
;
time1:=
0.1
;
while
time1<t_stop1
do
begin
runge(x,y);
Chart2
.
Series[
0
].AddXY(y,z);
Chart3
.
Series[
0
].AddXY(time1,x);
Application
.
ProcessMessages;
time1:=time1+
0.1
;
end
;
end
;
end
.