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

📄 sor.dem

📁 Delphi Pascal 数据挖掘领域算法包 数值算法大全
💻 DEM
字号:
PROGRAM d17r1(input,output);
(* driver for routine SOR *)
CONST
   jmax=11;
   pi=3.1415926;
TYPE
   double = real;
   gljmax = ARRAY [1..jmax,1..jmax] OF double;
VAR
   i,j,midl : integer;
   rjac : double;
   a,b,c,d,e,f,u : gljmax;

(*$I SOR.PAS *)

BEGIN
   FOR i := 1 to jmax DO BEGIN
      FOR j := 1 to jmax DO BEGIN
         a[i,j] := 1.0;
         b[i,j] := 1.0;
         c[i,j] := 1.0;
         d[i,j] := 1.0;
         e[i,j] := -4.0;
         f[i,j] := 0.0;
         u[i,j] := 0.0
      END
   END;
   midl := (jmax DIV 2)+1;
   f[midl,midl] := 2.0;
   rjac := cos(pi/jmax);
   sor(a,b,c,d,e,f,u,jmax,rjac);
   writeln('SOR Solution:');
   FOR i := 1 to jmax DO BEGIN
      FOR j := 1 to jmax DO write(u[i,j]:7:2);
      writeln
   END;
   writeln;
   writeln('Test that solution satisfies difference eqns:');
   FOR i := 2 to (jmax-1) DO BEGIN
      FOR j := 2 to (jmax-1) DO BEGIN
         f[i,j] := u[i+1,j]+u[i-1,j]+u[i,j+1]
            +u[i,j-1]-4.0*u[i,j]
      END;
      write(' ':7);
      FOR j := 2 to (jmax-1) DO write(f[i,j]:7:2);
      writeln
   END
END.

⌨️ 快捷键说明

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