procedure TForm1.Button1Click(Sender: TObject);
var
mu,sigma:Extended;
i,n:integer;
x:double;
begin
randomize;
mu:=strtoint(edit1.text);
sigma:=strtoint(edit2.Text);
n:=strtoint(edit3.text);
for i:=0 to n-1 do
begin
x:=randg(mu,sigma);
memo1.lines.add(formatfloat('0.###',x));
end;
end;
end.
else if etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
else if etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
6 Haziran 2014 Cuma
3 Haziran 2014 Salı
Stringgrid,button example. Colcount,Row Count
procedure TForm1.Button1Click(Sender: TObject);
var
r,c,j,i:integer;
begin
r:=strtoint(edit1.text);
c:=strtoint(edit2.text);
StringGrid1.ColCount:=c+1;
StringGrid1.RowCount:=r+1;
for i:=1 to c do
begin
for j:=1 to r do
begin
if (i+j)>r+2 StringGrid1.Cells[i,j]:=inttostr((i+j)-1);
end;
end;
end;
end.
var
r,c,j,i:integer;
begin
r:=strtoint(edit1.text);
c:=strtoint(edit2.text);
StringGrid1.ColCount:=c+1;
StringGrid1.RowCount:=r+1;
for i:=1 to c do
begin
for j:=1 to r do
begin
if (i+j)>r+2
end;
end;
end;
end.
Etiketler:
button,
button1,
delphi,
edit1,
else if,
formatfloat,
if,
integer,
maxvalue,
mean,
minvalue,
progressbar,
random,
randomize,
randomrange,
setlength,
stringgrid,
zar
28 Mayıs 2014 Çarşamba
list of integers,square of integers,square root of integers,stringgrid,progressbar example
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,j,k:integer;
begin
a:=strtoint(edit1.text);
b:=strtoint(edit2.text);
StringGrid1.RowCount:=(b-a+1)+1;
for j:=1 to stringgrid1.RowCount-1 do
StringGrid1.Cells[0,j]:=inttostr(j);
j:=0;
ProgressBar1.Max:=b-a+1;
if RadioButton1.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=inttostr(k);
ProgressBar1.Position:=j;
end;
end
else if RadioButton2.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=inttostr(sqr(k));
ProgressBar1.Position:=j;
end;
end
else if RadioButton3.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=floattostr(sqrt(k));
ProgressBar1.Position:=j;
end;
end;
end;
end.
var
a,b,j,k:integer;
begin
a:=strtoint(edit1.text);
b:=strtoint(edit2.text);
StringGrid1.RowCount:=(b-a+1)+1;
for j:=1 to stringgrid1.RowCount-1 do
StringGrid1.Cells[0,j]:=inttostr(j);
j:=0;
ProgressBar1.Max:=b-a+1;
if RadioButton1.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=inttostr(k);
ProgressBar1.Position:=j;
end;
end
else if RadioButton2.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=inttostr(sqr(k));
ProgressBar1.Position:=j;
end;
end
else if RadioButton3.Checked then
begin
for k:=a to b do
begin
inc(j);
StringGrid1.Cells[1,j]:=floattostr(sqrt(k));
ProgressBar1.Position:=j;
end;
end;
end;
end.
Etiketler:
button,
delphi,
edit1,
else if,
if,
integer,
progressbar,
stringgrid
9 Mayıs 2014 Cuma
Rastgele veri üretmek,Normalizasyon yöntemi(min-max,z score)
ihtiyacımız olanlar ; button,2 tane memo, combobox
ilk olarak button1 ın onclick event'ına aşagıdaki kodları giriyoruz.
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
x:real;
begin
Memo1.Clear;
Randomize; // bu işlem sayesınde button'a her tıkladıgımızda farklı sayılar geliyo
for i:=1 to 100 do //örneklem geniligini kendimiz 100 olrak belirledik
begin
x:=Random*(10-0)+0; //U(0,10);
memo1.Lines.Add(Floattostr(x));
end;
end;
Not: Randomrange tamsayılarda çalıştığı için burada Random kullanarak real sayılar elde etmeye çalıştık.
Örneklem büyüklüğü 100 olarak almamaza ragmen bir editbox koyarak kullanıcının girmesini sağlayabiliriz.
combobox1 in onchange event'ına aşagıdaki kodları giriyoruz ;
procedure TForm1.ComboBox1Change(Sender: TObject);
var
data,x:array of double;
n,i:integer;
min,max,xbar,std:real;
begin
n:=memo1.Lines.Count;
SetLength(data,n);
SetLength(x,n);
for i:=0 to n-1 do
data[i]:=strtofloat(memo1.lines[i]);
memo2.clear;
if ComboBox1.ItemIndex=0 then
begin
min:=MinValue(data);
max:=MaxValue(data);
for i:=0 to n-1 do
begin
x[i]:=(data[i]-min)/(max-min);
memo2.Lines.add(formatfloat('0.##0',x[i]));
end;
end
else if ComboBox1.ItemIndex=1 then
begin
xbar:=Mean(data);
std:=stddev(data);
for i:=0 to n-1 do
begin
x[i]:=((data[i]-xbar)/std);
memo2.Lines.add(formatfloat('0.##0',x[i]));
end;
end;
end;
end.
Bu kod da kullandığımız önemli sayılan kodlar aşağıda listelenmiştir.
min:=MinValue(); // minimum değeri bulur.
max:=MaxValue(); // maximum değeri bulur.
xbar:=Mean(); // ortalama bulur.
std:=stddev(); // Standart Sapmayı bulur.
ilk olarak button1 ın onclick event'ına aşagıdaki kodları giriyoruz.
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
x:real;
begin
Memo1.Clear;
Randomize; // bu işlem sayesınde button'a her tıkladıgımızda farklı sayılar geliyo
for i:=1 to 100 do //örneklem geniligini kendimiz 100 olrak belirledik
begin
x:=Random*(10-0)+0; //U(0,10);
memo1.Lines.Add(Floattostr(x));
end;
end;
Not: Randomrange tamsayılarda çalıştığı için burada Random kullanarak real sayılar elde etmeye çalıştık.
Örneklem büyüklüğü 100 olarak almamaza ragmen bir editbox koyarak kullanıcının girmesini sağlayabiliriz.
combobox1 in onchange event'ına aşagıdaki kodları giriyoruz ;
procedure TForm1.ComboBox1Change(Sender: TObject);
var
data,x:array of double;
n,i:integer;
min,max,xbar,std:real;
begin
n:=memo1.Lines.Count;
SetLength(data,n);
SetLength(x,n);
for i:=0 to n-1 do
data[i]:=strtofloat(memo1.lines[i]);
memo2.clear;
if ComboBox1.ItemIndex=0 then
begin
min:=MinValue(data);
max:=MaxValue(data);
for i:=0 to n-1 do
begin
x[i]:=(data[i]-min)/(max-min);
memo2.Lines.add(formatfloat('0.##0',x[i]));
end;
end
else if ComboBox1.ItemIndex=1 then
begin
xbar:=Mean(data);
std:=stddev(data);
for i:=0 to n-1 do
begin
x[i]:=((data[i]-xbar)/std);
memo2.Lines.add(formatfloat('0.##0',x[i]));
end;
end;
end;
end.
Bu kod da kullandığımız önemli sayılan kodlar aşağıda listelenmiştir.
min:=MinValue(); // minimum değeri bulur.
max:=MaxValue(); // maximum değeri bulur.
xbar:=Mean(); // ortalama bulur.
std:=stddev(); // Standart Sapmayı bulur.
Kaydol:
Kayıtlar (Atom)



