Метод Либмана
Программа решения эллиптического дифференциального уравнения (уравнения Лапласа) методом Либмана.
program DifurEllips; uses Crt; Const n= 10; m=10; e=0.001; h=1; l=1; var u:array[0..60,0..60] of Real; i,j,it,m1,n1:Integer; r,d,unew:Real; p:Boolean; procedure Libman; var i,j:Integer; Begin p:=False; for i:=1 to m1-1 do begin for j:=1 to n1-1 do begin uNew:=0/25*(u[i+1,j]+u[i-1,j]+u[i,j-1]+u[i,j+1]); d:=Abs(unew-u[i,j]); if d>e then p:=True; u[i,j]:=unew; end; end; End; function F1(x:Real):real; begin F1:=-Sqr(x); end; function F2(x:Real):real; begin F2:=16+8*x-sqr(x); end; function F3(x:Real):real; begin F3:=Sqr(x); end; function F4(x:Real):real; begin F4:=sqr(x)+6*x-9; end; BEGIN ClrScr; n1:=Trunc(n/h); m1:=Trunc(m/l); for i:=1 to m1 do for j:=1 to n1 do u[i,j]:=0; for j:=0 to m1 do u[0,j]:=F1(j*h); for j:=0 to m1 do u[n1,j]:=F2(j*h); for i:=1 to n1 do u[i,0]:=F3(i*h); for i:=1 to n1 do u[i,m1]:=F4(i*h); Libman; it:=1; while p and (it<100) do begin libman; it:=it+1; end; writeln('Rezyltati vichisleniy'); write(''); for j:=0 to n1 do write(j*h:2,''); Writeln(); Writeln(); for i:=m1 downto n do begin write('',i*l:2,'|'); for j:=0 to n1 do begin write(u[i,j]:3:2,''); Writeln(''); end; end; Writeln(''); Writeln(' '); for j:=0 to n1 do Write(j*h:2,' '); Writeln(''); Writeln(''); Writeln(' Chislo iterashiy: ',it:2); Writeln(' Pogreshnost e= ',e:1:3); while not keypressed do; END.