⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 irbit2.dem

📁 Delphi Pascal 数据挖掘领域算法包 数值算法大全
💻 DEM
字号:
PROGRAM d7r11(input,output);
(* driver for routine IRBIT2 *)
(* calculate distribution of runs of zeros *)
CONST
   nbin=15;
   ntries=500;
VAR
   i,iflg,ipts,iseed,j,n : integer;
   delay : ARRAY [1..nbin] OF real;

FUNCTION twoton(n : integer) : integer;
BEGIN
   IF (n=0) THEN twoton := 1
   ELSE twoton := 2*twoton(n-1)
END;

(*$I MODFILE.PAS *)
(*$I IRBIT2.PAS *)

BEGIN
   iseed := 111;
   FOR i := 1 to nbin DO BEGIN
      delay[i] := 0.0
   END;
   ipts := 0;
   FOR i := 1 to ntries DO BEGIN
      IF (irbit2(iseed) = 1) THEN BEGIN
         ipts := ipts+1;
         iflg := 0;
         FOR j := 1 to nbin DO BEGIN
            IF ((irbit2(iseed) = 1) AND (iflg = 0)) THEN BEGIN
               iflg := 1;
               delay[j] := delay[j]+1.0
            END
         END
      END
   END;
   writeln ('distribution of runs of n zeros');
   writeln ('n':6,'probability':22,'expected':18);
   FOR n := 1 to nbin DO BEGIN
      writeln ((n-1):6,delay[n]/ipts:19:4,1/twoton(n):20:4);
   END
END.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -