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

📄 midsql.pas

📁 Delphi Pascal 数据挖掘领域算法包 数值算法大全
💻 PAS
字号:
PROCEDURE midsql(aa,bb: real; VAR s: real; n: integer);
(* Programs using MIDSQL must define the function to be integrated
with the declaration FUNCTION func(x: real): real; They must also declare
the global variable
VAR
   glit: integer; *)
VAR
   j: integer;
   x,tnm,sum,del,ddel,b,a: real;
FUNCTION funk(x: real): real;
   BEGIN
      funk := 2.0*x*func(aa+sqr(x))
   END;
BEGIN
   b := sqrt(bb-aa);
   a := 0.0;
   IF (n = 1) THEN BEGIN
      s := (b-a)*funk(0.5*(a+b));
      glit := 1
   END ELSE BEGIN
      tnm := glit;
      del := (b-a)/(3.0*tnm);
      ddel := del+del;
      x := a+0.5*del;
      sum := 0.0;
      FOR j := 1 TO glit DO BEGIN
         sum := sum+funk(x);
         x := x+ddel;
         sum := sum+funk(x);
         x := x+del
      END;
      s := (s+(b-a)*sum/tnm)/3.0;
      glit := 3*glit
   END
END;

⌨️ 快捷键说明

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