Senin, 14 September 2009

Fungsi Pembangkit Variabel Random


Fungsi Distribusi Uniform

Function Uniform (a,b : double) : double;
Var u : double;
Begin
u := random;
Uniform := (b-a) * u + a;
End;

Fungsi Distribusi Eksponensial

Function Eksponensial (beta : double) : double;
Var u : double;
Begin
u := random;
Eksponensial := -beta * ln(u);
End;

Fungsi Distribusi Normal

Procedure Normal (mean,variance : double ; Var z1,z2 : double);
Var u1,u2,v1,v2,w,y,x1,x2 : double;
Begin
Repeat
u1 := random;
u2 := random;
v1 := 2 * u1 – 1;
v2 := 2 * u2 – 1;
w := sqr(v1) + sqr(v2);
if w <= 1 then
begin
y := sqrt ((-2*ln(w))/w);
x1 := v1 * y;
x2 := v2 * y;
z1 := sqrt (variance) * x1 + mean;
z2 := sqrt (variance) * x2 + mean;
end
Until w <= 1;
End;
Procedure Distribusi Lognormal procedure lognormal (mean,varr : double; Var zln1,zln2 : double);
Var y1, y2 : double;
begin
Normal (mean,varr,y1,y2);
zln1 := exp(y1);
zln2 := exp(y2);
end;
Fungsi Distribusi Weibull Function Weibull (alfa,beta: double) : double;
Var u,z : double;
Begin u := random;
z := -ln(u);
Weibull := beta * exp (ln(z)/alfa);
End;
Fungsi Distribusi t-student function tdistribution(m:integer):double;
Label r2;
Var v,x,r,s,c,a,f,g,mm : real;
begin mm:=0;
if m < 1 then begin writeln('impermissible degrees of freedom.'); halt;
end;
if (m mm) then begin s:=m; c:=-0.25*(s+1);
a:=4/power((1+1/s),c);
f:=16/a;
if m>1 then
begin
g:=s-1;
g:=power(((s+1)/g),c)*sqrt((s+s)/g);
end else
g := 1;
mm:=m;
end;
r2:repeat
r:=random;
until r > 0.0;
x:=(2*random-1)*g/r;
v:=x*x;
if (v>(5-a*r)) then
begin
if ((m>=3) and (r*(v+3)>f)) then goto r2;
if (r>power((1+v/s),c)) then goto r2;
end;
tdistribution :=x;
end;
begin
tipe11[1]:=0.2;
tipe11[1]:=0.3;
tipe11[1]:=0.5;
tipe11[1]:=0.8;
tipe11[1]:=1.0;
end.

36 komentar:

PercyAyer mengatakan...

目標是什麼不重要,目標能產生什麼樣的效果才重要..................................................

電信 mengatakan...

來拜訪你囉~期待你的下次文章~加油^^.........................

作弊 mengatakan...

要保持更新呦,加油!!!期待你的新文章!!! ........................................

仲亨仲亨 mengatakan...

喜樂的心是健康良藥,憂傷的靈使骨枯乾。........................................

長宜芳修 mengatakan...

原來這世上能跟你共同領略一個笑話的人竟如此難得........................................

宗穎 mengatakan...

Nice blog85cc,咆哮小老鼠,85街,免費影片,情趣爽翻天,愛戀情人用品,交友找啦咧,線上a片,女同志聊天室,sexy,色情網站,網愛聊天室,情色性愛貼圖,小穴,性愛姿勢,陰脣室,成人圖貼,性愛技巧,a片論壇,色情,85c,sexy網,人妻,脫衣,6k,18禁,手淫,性幻想,77p2p,情色,1007,85c,0401,後宮,色情,淫蕩,正妹,77p2p,ut室

維青 mengatakan...

85cc片觀看,77美女dvd影片,熊貓貼區,ut網際聊天,一葉情,av,嘟嘟,影音live秀,a片,做愛影片,視訊做愛,美女短片,78論壇,ut聊天,打飛機,a片,免費視訊,免費視訊,成人影院,性愛小說,辣妹視訊,網路交友,捷克論壇,h影片,色咪咪,免費影片85cc,kiss911,後宮,a片,影音視訊聊天,交友,免費聊天,聊天室交友,做愛影片,線上a片,美女影片,免費影片下載,免費聊天室,視訊做愛,美女視訊聊天

子凌50529nealsickles mengatakan...

GOOD........................................

GlaydsJ惠珠 mengatakan...

每一粒厄運的種子,卻包孕著未來豐盛的果實........................................

許淑福 mengatakan...

成功等於目前,其他都是這句話的註解。.............................................

振宇 mengatakan...

祝福你人氣不減ˊˇˋ.........................

730A_ngelinaRabideau0 mengatakan...

All roads lead to Rome. 堅持自己所選! ........................................

冠宛君中 mengatakan...

朋友是一面鏡子 ............................................................

adkinsra mengatakan...

好的部落格,希望您能繼續堅持!!!..................................................

淑娟 mengatakan...

It is easier to get than to keep it...................................................................

慧君 mengatakan...

Necessity is the mother of invention...................................................................

saas mengatakan...

這麼好的部落格,以後看不到怎麼辦啊!!......................................................................

王瑞 mengatakan...

河水永遠是相同的,可是每一剎那又都是新的。......................................................................

凱文凱文 mengatakan...

成熟,就是有能力適應生活中的模糊。.................................................................

陳登陽 mengatakan...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

懿綺懿綺 mengatakan...

教育的目的,不在應該思考什麼,而是教吾人怎樣思考............................................................

雅莊王edgd春2蕙婷余惠其 mengatakan...

成功可招引朋友,挫敗可考驗朋友............................................................

添d卉王賴uou珮甄賴賴 mengatakan...

let us be happey everyday!!............................................................

雅俊芬凱陳許 mengatakan...

生命的意義,是在於活的充實;而不是在於活得長久。............................................................

香昱信張君林 mengatakan...

聰明人之所以不會成功,是因為他們缺乏了堅忍的毅力。..................................................

陳璇竹陳璇竹 mengatakan...

每日都有新日光,每日都有新希望。..................................................

RicoLisi0802志竹 mengatakan...

百發百中不是一試就成的。..................................................

曹初帆張武茜 mengatakan...

I do like ur article~!!!..................................................................

怡謝伶 mengatakan...

良好的開端,已是成功的一半。..................................................

文陳秀文陳秀 mengatakan...

愛情是一種發明,需要不斷改良。只是,這種發明和其他發明不一樣,它沒有專利權,隨時會被人搶走。.................................................................

偉曹琬 mengatakan...

Every why has a wherefore.............................................................

怡張樺怡張樺怡張樺 mengatakan...

德不孤,必有鄰。文不獨,必有應!..................................................................

孫邦柔 mengatakan...

道歉是人類一定必要的禮節..................................................

于庭吳 mengatakan...

活是一種鍛鍊靈魂的東西..................................................................

怡靜怡靜怡靜怡雯 mengatakan...

每次看完你的文章,總是回味許久,要經常發表喔。..................................................

冠州 mengatakan...

看到好文章心情就很好 ^^

Posting Komentar