unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
procedure PENDAG(A,B,C,D,E,R:array of real;var U:array of real; N:integer);
implementation
procedure PENDAG(A,B,C,D,E,R:array of real;var U:array of real; N:integer);
var
W,BETA,ALPHA,CG,H:array[0..100] of real;
K:integer;
begin
W[1]:=C[1];
BETA[1]:=0;
BETA[2]:=D[1] / W[1];
ALPHA[1]:=0;
ALPHA[2]:=E[1] / W[1];
ALPHA[N]:=0;
ALPHA[N + 1]:=0;
For K:=2 To N do
begin
CG[K]:=B[K] - A[K] * BETA[K - 1];
W[K]:=C[K] - A[K] * ALPHA[K - 1] - CG[K] * BETA[K];
If W[K] = 0 Then
ShowMessage('W[K]=0.0 in PENDAG');
BETA[K + 1]:=(D[K] - CG[K] * ALPHA[K]) / W[K];
ALPHA[K + 1]:=E[K] / W[K];
end;
H[1]:=0;
H[2]:=R[1] / W[1];
For K:=2 To N do
H[K + 1]:=(R[K] - A[K] * H[K - 1] - CG[K] * H[K]) / W[K];
U[N]:=H[N + 1];
U[N - 1]:=H[N] - BETA[N] * U[N];
For K:=N - 2 DownTo 1 do
U[K]:=H[K + 1] - BETA[K + 1] * U[K + 1] - ALPHA[K + 1] * U[K + 2];
end;
end.