unit Basis;
interface
const
h1 = 0.1;
h2 = h1;
hh = h2/(h1*h1);
LeftX = -1;
LeftY = 0;
RightX = 1;
RightY = 1;
lenghtX = (RightX-LeftX)/h1;
lenghtY = (RightY-LeftY)/h2;
boolX = Round(lenghtX)Trunc(lenghtX);
boolY = Round(lenghtY)Trunc(lenghtY);
n = Round((RightX-LeftX)/h1) + byte(boolX);
m = Round((RightY-LeftY)/h2) + byte(boolY);
type
Float = Extended;
TMathFunc = function(x,y :Float) :Float;
TVector = array [0..n] of Float;
TMatrix = array [0..m] of TVector;
function x(i :Float) :Float;
function y(j :Float) :Float;
function k(x,t :Float) :Float;
function f(x,t :Float) :Float;
function u0(i :Float) :Float;
function mu1(j :Float) :Float;
function mu2(j :Float) :Float;
function afunc(i,j :Float) :Float;
function phifunc(i,j :Float) :Float;
function Exact(i,j :Float) :Float;
implementation
uses Math;
function x(i :Float) :Float;
begin
Result := LeftX + i*h1;
end;
function y(j :Float) :Float;
begin
Result := LeftY + j*h2;
end;
function u0(i :Float) :Float; //nach. usl. y[i,0]
begin
//Result := 1/(1+sqr(x(i)));
Result := sqr(x(i));
end;
function mu1(j :Float) :Float; //kr. usl. y[0,j]
begin
//Result := 1/(1+y(j)+sqr(LeftX));
Result := sqr(y(j))+sqr(LeftX);
end;
function mu2(j :Float) :Float; //kr. usl. y[n,j]
begin
//Result := 1/(1+y(j)+sqr(RightX));
Result := sqr(y(j))+sqr(RightX);
end;
function k(x,t :Float) :Float;
begin
Result := sqr(t);
end;
function f(x,t :Float) :Float;
begin
Result := 2*t*(1-t);
end;
function afunc(i,j :Float) :Float;
begin
Result := k(x(i-1/2),y(j));
end;
function phifunc(i,j :Float) :Float;
begin
Result := f(x(i),y(j));
end;
function Exact(i,j :Float) :Float;
begin
//Result := 1/(sqr(x(i))+y(j)+1);
Result := sqr(x(i))+sqr(y(j));
end;
end.
|
|