Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

dedanoe's sponge comprexpander

0 vue
Accéder directement au premier message non lu

dedanoe

non lue,
3 mars 2008, 14:46:4303/03/2008
à
aj te molam vidi sho nechini so mojot calculus. vo poveketo od
sluchaevite toj e divergenten a i vo tie retki sluchai na
konvergencija resheniata se povtorno loshi. pred da go startash .exe-
to vidi go kodot vo .pas. ideata mi e da postavam ednakvost pomegu:

Singular1 x Original x Specific x Singular2 = Result = Singular1 x
Compression x Expansion x Singular2

taka sho
Original[3..5]=Specific[1..2]=Compression[2..5]=Expansion[1]=1.
znachi, od dva originala i tri specifiki pravam 1compresija i 4
expanzii so namera da gi zapisham samo compresijata illy samo
expanzijata pri sho mora da ima i povratni metodi za restavracija na
originalite.

http://dedanoe.googlepages.com/Sponge_Comprexpander.zip

dedanoe

non lue,
3 mars 2008, 14:48:1103/03/2008
à

from now on i'll write my messages in armageddonian

Neilist

non lue,
3 mars 2008, 15:49:2203/03/2008
à
> from now on i'll write my messages in armageddonian- Hide quoted text -
>
> - Show quoted text -

How about writing your messages in invisible ink instead?

Thomas Heger

non lue,
3 mars 2008, 18:25:2003/03/2008
à

"dedanoe" <ded...@gmail.com> schrieb im Newsbeitrag
news:59f88b43-ed23-4704...@x30g2000hsd.googlegroups.com...

On Mar 3, 8:46 pm, dedanoe <deda...@gmail.com> wrote:
> aj te molam vidi sho nechini so mojot calculus. vo poveketo od
> sluchaevite toj e divergenten a i vo tie retki sluchai na
> konvergencija resheniata se povtorno loshi. pred da go startash .exe-
> to vidi go kodot vo .pas. ideata mi e da postavam ednakvost pomegu:

Is that russian or czech ?


dedanoe

non lue,
4 mars 2008, 00:03:4104/03/2008
à
On Mar 3, 8:46 pm, dedanoe <deda...@gmail.com> wrote:

i have now fully functional version of my sponge comprexpander:
http://dedanoe.googlepages.com/Sponge_Comprexpander.zip
the calculus converges in all directions: (de)compression,
(de)expansion and so...

-------the code------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TVector3 = array[1..3] of Real;
TVector5 = array[1..5] of Real;
TVector6 = array[1..6] of Real;
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit10: TEdit;
Edit9: TEdit;
Edit8: TEdit;
Edit7: TEdit;
Edit6: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Edit20: TEdit;
Edit19: TEdit;
Edit18: TEdit;
Edit17: TEdit;
Edit16: TEdit;
Edit21: TEdit;
Edit22: TEdit;
Edit23: TEdit;
Edit24: TEdit;
Edit25: TEdit;
GroupBox2: TGroupBox;
Edit26: TEdit;
Edit27: TEdit;
Edit28: TEdit;
Edit29: TEdit;
Edit30: TEdit;
Edit35: TEdit;
Edit34: TEdit;
Edit33: TEdit;
Edit32: TEdit;
Edit31: TEdit;
Edit36: TEdit;
Edit37: TEdit;
Edit38: TEdit;
Edit39: TEdit;
Edit40: TEdit;
Edit45: TEdit;
Edit44: TEdit;
Edit43: TEdit;
Edit42: TEdit;
Edit41: TEdit;
Edit46: TEdit;
Edit47: TEdit;
Edit48: TEdit;
Edit49: TEdit;
Edit50: TEdit;
GroupBox3: TGroupBox;
Button2: TButton;
Button3: TButton;
Button4: TButton;
GroupBox4: TGroupBox;
RadioGroup1: TRadioGroup;
Button1: TButton;
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Label1: TLabel;
Button5: TButton;
Timer4: TTimer;
Label2: TLabel;
procedure Timer4Timer(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Singular1, Singular2,
Original, Specific,
Compression, Expansion: TVector5;
StartingTime, EndingTime: TDateTime;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function Norm3(V: TVector3): Real;
begin
Result:= Sqrt(Sqr(V[1])
+ Sqr(V[2])
+ Sqr(V[3]));
end;

function Sc3(V1, V2: TVector3): Real;
begin
Result:= V1[1] * V2[1]
+ V1[2] * V2[2]
+ V1[3] * V2[3];
end;

function Sum3(V1, V2: TVector3): TVector3;
begin
Result[1]:= V1[1] + V2[1];
Result[2]:= V1[2] + V2[2];
Result[3]:= V1[3] + V2[3];
end;

function Ext3(V1: Real; V2: TVector3): TVector3;
begin
Result[1]:= V1 * V2[1];
Result[2]:= V1 * V2[2];
Result[3]:= V1 * V2[3];
end;

function Dif3(V1, V2: TVector3): TVector3;
begin
Result:= Sum3(V1, Ext3(-1, V2));
end;

function Norm5(V: TVector5): Real;
begin
Result:= Sqrt(Sqr(V[1])
+ Sqr(V[2])
+ Sqr(V[3])
+ Sqr(V[4])
+ Sqr(V[5]));
end;

function Sc5(V1, V2: TVector5): Real;
begin
Result:= V1[1] * V2[1]
+ V1[2] * V2[2]
+ V1[3] * V2[3]
+ V1[4] * V2[4]
+ V1[5] * V2[5];
end;

function Sum5(V1, V2: TVector5): TVector5;
begin
Result[1]:= V1[1] + V2[1];
Result[2]:= V1[2] + V2[2];
Result[3]:= V1[3] + V2[3];
Result[4]:= V1[4] + V2[4];
Result[5]:= V1[5] + V2[5];
end;

function Ext5(V1: Real; V2: TVector5): TVector5;
begin
Result[1]:= V1 * V2[1];
Result[2]:= V1 * V2[2];
Result[3]:= V1 * V2[3];
Result[4]:= V1 * V2[4];
Result[5]:= V1 * V2[5];
end;

function Dif5(V1, V2: TVector5): TVector5;
begin
Result:= Sum5(V1, Ext5(-1, V2));
end;

function Norm6(V: TVector6): Real;
begin
Result:= Sqrt(Sqr(V[1])
+ Sqr(V[2])
+ Sqr(V[3])
+ Sqr(V[4])
+ Sqr(V[5])
+ Sqr(V[6]));
end;

function Sc6(V1, V2: TVector6): Real;
begin
Result:= V1[1] * V2[1]
+ V1[2] * V2[2]
+ V1[3] * V2[3]
+ V1[4] * V2[4]
+ V1[5] * V2[5]
+ V1[6] * V2[6];
end;

function Sum6(V1, V2: TVector6): TVector6;
begin
Result[1]:= V1[1] + V2[1];
Result[2]:= V1[2] + V2[2];
Result[3]:= V1[3] + V2[3];
Result[4]:= V1[4] + V2[4];
Result[5]:= V1[5] + V2[5];
Result[6]:= V1[6] + V2[6];
end;

function Ext6(V1: Real; V2: TVector6): TVector6;
begin
Result[1]:= V1 * V2[1];
Result[2]:= V1 * V2[2];
Result[3]:= V1 * V2[3];
Result[4]:= V1 * V2[4];
Result[5]:= V1 * V2[5];
Result[6]:= V1 * V2[6];
end;

function Dif6(V1, V2: TVector6): TVector6;
begin
Result:= Sum6(V1, Ext6(-1, V2));
end;

function RNDSingular: TVector5;
begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);
until Norm5(Result) <> 0;
Result:= Ext5(1/Norm5(Result), Result);
end;

function RNDSpecific: TVector5;
begin
Randomize;
repeat
Result[1]:= 1;
Result[2]:= 1;
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);
until Norm5(Result) <> 0;
end;

function RNDOriginal: TVector5;
begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 1;
Result[4]:= 1;
Result[5]:= 1;
until Norm5(Result) <> 0;
end;

function RNDCompression: TVector5;
begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 1;
Result[3]:= 1;
Result[4]:= 1;
Result[5]:= 1;
until Norm5(Result) <> 0;
end;

function RNDExpansion: TVector5;
begin
Randomize;
repeat
Result[1]:= 1;
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);
until Norm5(Result) <> 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Singular1:= RNDSingular;
Edit6.Text:= FloatToStr(Singular1[1]);
Edit7.Text:= FloatToStr(Singular1[2]);
Edit8.Text:= FloatToStr(Singular1[3]);
Edit9.Text:= FloatToStr(Singular1[4]);
Edit10.Text:= FloatToStr(Singular1[5]);
Edit31.Text:= FloatToStr(Singular1[1]);
Edit32.Text:= FloatToStr(Singular1[2]);
Edit33.Text:= FloatToStr(Singular1[3]);
Edit34.Text:= FloatToStr(Singular1[4]);
Edit35.Text:= FloatToStr(Singular1[5]);
Specific:= RNDSpecific;
Edit16.Text:= FloatToStr(Specific[1]);
Edit17.Text:= FloatToStr(Specific[2]);
Edit18.Text:= FloatToStr(Specific[3]);
Edit19.Text:= FloatToStr(Specific[4]);
Edit20.Text:= FloatToStr(Specific[5]);
Singular2:= RNDSingular;
Edit21.Text:= FloatToStr(Singular2[1]);
Edit22.Text:= FloatToStr(Singular2[2]);
Edit23.Text:= FloatToStr(Singular2[3]);
Edit24.Text:= FloatToStr(Singular2[4]);
Edit25.Text:= FloatToStr(Singular2[5]);
Edit46.Text:= FloatToStr(Singular2[1]);
Edit47.Text:= FloatToStr(Singular2[2]);
Edit48.Text:= FloatToStr(Singular2[3]);
Edit49.Text:= FloatToStr(Singular2[4]);
Edit50.Text:= FloatToStr(Singular2[5]);
case RadioGroup1.ItemIndex of
0: begin
Original:= RNDOriginal;
Edit11.Text:= FloatToStr(Original[1]);
Edit12.Text:= FloatToStr(Original[2]);
Edit13.Text:= FloatToStr(Original[3]);
Edit14.Text:= FloatToStr(Original[4]);
Edit15.Text:= FloatToStr(Original[5]);
Button2.Enabled:= True;
Button3.Enabled:= False;
Button4.Enabled:= False;
Button5.Enabled:= True;
end;
1: begin
Compression:= RNDCompression;
Edit36.Text:= FloatToStr(Compression[1]);
Edit37.Text:= FloatToStr(Compression[2]);
Edit38.Text:= FloatToStr(Compression[3]);
Edit39.Text:= FloatToStr(Compression[4]);
Edit40.Text:= FloatToStr(Compression[5]);
Button2.Enabled:= False;
Button3.Enabled:= True;
Button4.Enabled:= False;
Button5.Enabled:= True;
end;
2: begin
Expansion:= RNDExpansion;
Edit41.Text:= FloatToStr(Expansion[1]);
Edit42.Text:= FloatToStr(Expansion[2]);
Edit43.Text:= FloatToStr(Expansion[3]);
Edit44.Text:= FloatToStr(Expansion[4]);
Edit45.Text:= FloatToStr(Expansion[5]);
Button2.Enabled:= False;
Button3.Enabled:= False;
Button4.Enabled:= True;
Button5.Enabled:= True;
end;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Timer1.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Timer2.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
Timer3.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
Button2.Enabled:= False;
Button3.Enabled:= False;
Button4.Enabled:= False;
Button5.Enabled:= False;
Timer1.Enabled:= False;
Timer2.Enabled:= False;
Timer3.Enabled:= False;
Timer4.Enabled:= False;
end;

function ProductIs(V1, V2, V3, V4: TVector5): TVector5;
begin
Result[1]:= V1[2] * V2[3] * V3[4] * V4[5] + V1[3] * V2[4] * V3[5] *
V4[1] + V1[4] * V2[5] * V3[1] * V4[2] + V1[5] * V2[1] * V3[2] * V4[3]
- V4[2] * V3[3] * V2[4] * V1[5] - V4[3] * V3[4] * V2[5] *
V1[1] - V4[4] * V3[5] * V2[1] * V1[2] - V4[5] * V3[1] * V2[2] * V1[3];
Result[2]:= V1[3] * V2[4] * V3[5] * V4[1] + V1[4] * V2[5] * V3[1] *
V4[2] + V1[5] * V2[1] * V3[2] * V4[3] + V1[1] * V2[2] * V3[3] * V4[4]
- V4[3] * V3[4] * V2[5] * V1[1] - V4[4] * V3[5] * V2[1] *
V1[2] - V4[5] * V3[1] * V2[2] * V1[3] - V4[1] * V3[2] * V2[3] * V1[4];
Result[3]:= V1[4] * V2[5] * V3[1] * V4[2] + V1[5] * V2[1] * V3[2] *
V4[3] + V1[1] * V2[2] * V3[3] * V4[4] + V1[2] * V2[3] * V3[4] * V4[5]
- V4[4] * V3[5] * V2[1] * V1[2] - V4[5] * V3[1] * V2[2] *
V1[3] - V4[1] * V3[2] * V2[3] * V1[4] - V4[2] * V3[3] * V2[4] * V1[5];
Result[4]:= V1[5] * V2[1] * V3[2] * V4[3] + V1[1] * V2[2] * V3[3] *
V4[4] + V1[2] * V2[3] * V3[4] * V4[5] + V1[3] * V2[4] * V3[5] * V4[1]
- V4[5] * V3[1] * V2[2] * V1[3] - V4[1] * V3[2] * V2[3] *
V1[4] - V4[2] * V3[3] * V2[4] * V1[5] - V4[3] * V3[4] * V2[5] * V1[1];
Result[5]:= V1[1] * V2[2] * V3[3] * V4[4] + V1[2] * V2[3] * V3[4] *
V4[5] + V1[3] * V2[4] * V3[5] * V4[1] + V1[4] * V2[5] * V3[1] * V4[2]
- V4[1] * V3[2] * V2[3] * V1[4] - V4[2] * V3[3] * V2[4] *
V1[5] - V4[3] * V3[4] * V2[5] * V1[1] - V4[4] * V3[5] * V2[1] * V1[2];
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var Compression1, Compression2,
Expansion1, Expansion2,
Error1, Error2, V1, V2,
Product1, Product2: TVector5;

function Rationed(x1, x2, E1, E2: TVector5): TVector5;
var
Det, Det1, Det2: Extended;
M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
sys: array[1..2, 1..2] of TVector5;
begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum5(Ext5(M1[1,1], E1), Ext5(M1[1,2], E2));
sys[1,2]:= Sum5(Ext5(M1[2,1], E1), Ext5(M1[2,2], E2));
sys[2,1]:= Sum5(Ext5(M2[1,1], E1), Ext5(M2[1,2], E2));
sys[2,2]:= Sum5(Ext5(M2[2,1], E1), Ext5(M2[2,2], E2));

sys[1,1]:= Ext5(1/Norm5(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext5(1/Norm5(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext5(1/Norm5(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext5(1/Norm5(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc5(E1, sys[1,1]);
Coor1[1,2]:= Sc5(E1, sys[1,2]);
Coor1[2,1]:= Sc5(E1, sys[2,1]);
Coor1[2,2]:= Sc5(E1, sys[2,2]);

Coor2[1,1]:= Sc5(E2, sys[1,1]);
Coor2[1,2]:= Sc5(E2, sys[1,2]);
Coor2[2,1]:= Sc5(E2, sys[2,1]);
Coor2[2,2]:= Sc5(E2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;

repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
until M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1] <> 0;
//creating a vector5 system
sys[1,1]:= Sum5(Ext5(M1[1,1], x1), Ext5(M1[1,2], x2));
sys[1,2]:= Sum5(Ext5(M1[2,1], x1), Ext5(M1[2,2], x2));
//|sys[1,1]| = |sys[1,2]| = 1
sys[1,1]:= Ext5(1/Norm5(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext5(1/Norm5(sys[1,2]), sys[1,2]);
//aquiring the 1d-coordinates for x1-x2
Coor1[1,1]:= Sc5(Dif5(x1, x2), sys[1,1]);
Coor1[1,2]:= Sc5(Dif5(x1, x2), sys[1,2]);
//rotation and shrinking by M
Coor1[2,1]:= M[1,1]*Coor1[1,1] + M[1,2]*Coor1[1,2];
Coor1[2,2]:= M[2,1]*Coor1[1,1] + M[2,2]*Coor1[1,2];
//summing
Result:= Sum5(Ext5(Coor1[2,1], sys[1,1]),
Ext5(Coor1[2,2], sys[1,2]));
end;

begin
Product1:= ProductIs(Singular1, Original, Specific, Singular2);
Edit1.Text:= FloatToStr(Product1[1]);
Edit2.Text:= FloatToStr(Product1[2]);
Edit3.Text:= FloatToStr(Product1[3]);
Edit4.Text:= FloatToStr(Product1[4]);
Edit5.Text:= FloatToStr(Product1[5]);
Compression1:= RNDCompression; Expansion1:= RNDExpansion;
Error1:= Dif5(ProductIs(Singular1, Compression1, Expansion1,
Singular2), Product1);
Compression2:= RNDCompression; Expansion2:= RNDExpansion;
Error2:= Dif5(ProductIs(Singular1, Compression2, Expansion2,
Singular2),
ProductIs(Singular1, Original, Specific, Singular2));
V1[1]:= Compression1[1]; V1[2]:= Expansion1[2]; V1[3]:=
Expansion1[3]; V1[4]:= Expansion1[4]; V1[5]:= Expansion1[5];
V2[1]:= Compression2[1]; V2[2]:= Expansion2[2]; V2[3]:=
Expansion2[3]; V2[4]:= Expansion2[4]; V2[5]:= Expansion2[5];
Label2.Caption:= '|UpResult-DownResult| = ' +
FloatToStr(Norm5(Dif5(Error1, Error2)));
if Norm5(Error1) > Norm5(Error2) then begin
Product2:= ProductIs(Singular1, Compression1, Expansion1,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V1:= Sum5(V1, Rationed(V1, V2, Error1, Error2));
end else if Norm5(Error2) > Norm5(Error1) then begin
Product2:= ProductIs(Singular1, Compression2, Expansion2,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V2:= Sum5(V2, Rationed(V2, V1, Error2, Error1));
end;
Edit36.Text:= FloatToStr(V1[1]);
Edit42.Text:= FloatToStr(V1[2]);
Edit43.Text:= FloatToStr(V1[3]);
Edit44.Text:= FloatToStr(V1[4]);
Edit45.Text:= FloatToStr(V1[5]);
if Abs(Norm5(Error1)-Norm5(Error2)) < 1E-10 then begin
Timer1.Enabled:= False;
Timer4.Enabled:= False;
Button2.Enabled:= False;
Button5.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
var
Original1, Original2,
Expansion1, Expansion2,
Error1, Error2,
Product1, Product2: TVector5;
V1, V2: TVector6;

function Rationed(x1, x2: TVector6; E1, E2: TVector5): TVector6;
var
Det, Det1, Det2: Extended;
M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
sys: array[1..2, 1..2] of TVector5;
sys1: array[1..2] of TVector6;
begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum5(Ext5(M1[1,1], E1), Ext5(M1[1,2], E2));
sys[1,2]:= Sum5(Ext5(M1[2,1], E1), Ext5(M1[2,2], E2));
sys[2,1]:= Sum5(Ext5(M2[1,1], E1), Ext5(M2[1,2], E2));
sys[2,2]:= Sum5(Ext5(M2[2,1], E1), Ext5(M2[2,2], E2));

sys[1,1]:= Ext5(1/Norm5(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext5(1/Norm5(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext5(1/Norm5(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext5(1/Norm5(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc5(E1, sys[1,1]);
Coor1[1,2]:= Sc5(E1, sys[1,2]);
Coor1[2,1]:= Sc5(E1, sys[2,1]);
Coor1[2,2]:= Sc5(E1, sys[2,2]);

Coor2[1,1]:= Sc5(E2, sys[1,1]);
Coor2[1,2]:= Sc5(E2, sys[1,2]);
Coor2[2,1]:= Sc5(E2, sys[2,1]);
Coor2[2,2]:= Sc5(E2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;

repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
until M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1] <> 0;
//creating a vector5 system
sys1[1]:= Sum6(Ext6(M1[1,1], x1), Ext6(M1[1,2], x2));
sys1[2]:= Sum6(Ext6(M1[2,1], x1), Ext6(M1[2,2], x2));
//|sys[1,1]| = |sys[1,2]| = 1
sys1[1]:= Ext6(1/Norm6(sys1[1]), sys1[1]);
sys1[2]:= Ext6(1/Norm6(sys1[2]), sys1[2]);
//aquiring the 1d-coordinates for x1-x2
Coor1[1,1]:= Sc6(Dif6(x1, x2), sys1[1]);
Coor1[1,2]:= Sc6(Dif6(x1, x2), sys1[2]);
//rotation and shrinking by M
Coor1[2,1]:= M[1,1]*Coor1[1,1] + M[1,2]*Coor1[1,2];
Coor1[2,2]:= M[2,1]*Coor1[1,1] + M[2,2]*Coor1[1,2];
//summing
Result:= Sum6(Ext6(Coor1[2,1], sys1[1]),
Ext6(Coor1[2,2], sys1[2]));
end;

begin
Original1:= RNDOriginal; Expansion1:= RNDExpansion;
Error1:= Dif5(ProductIs(Singular1, Original1, Specific, Singular2),
ProductIs(Singular1, Compression, Expansion1,
Singular2));
Original2:= RNDOriginal; Expansion2:= RNDExpansion;
Error2:= Dif5(ProductIs(Singular1, Original2, Specific, Singular2),
ProductIs(Singular1, Compression, Expansion2,
Singular2));
V1[1]:= Original1[1]; V1[2]:= Original1[2];
V1[3]:= Expansion1[2]; V1[4]:= Expansion1[3];
V1[5]:= Expansion1[4]; V1[6]:= Expansion1[5];
V2[1]:= Original2[1]; V2[2]:= Original2[2];
V2[3]:= Expansion2[2]; V2[4]:= Expansion2[3];
V2[5]:= Expansion2[4]; V2[6]:= Expansion2[5];
Label2.Caption:= '|UpResult-DownResult| = ' +
FloatToStr(Norm5(Dif5(Error1, Error2)));
if Norm5(Error1) > Norm5(Error2) then begin
Product1:= ProductIs(Singular1, Original1, Specific, Singular2);
Edit1.Text:= FloatToStr(Product1[1]);
Edit2.Text:= FloatToStr(Product1[2]);
Edit3.Text:= FloatToStr(Product1[3]);
Edit4.Text:= FloatToStr(Product1[4]);
Edit5.Text:= FloatToStr(Product1[5]);
Product2:= ProductIs(Singular1, Compression, Expansion1,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V1:= Sum6(V2, Rationed(V1, V2, Error1, Error2));
Edit11.Text:= FloatToStr(V1[1]);
Edit12.Text:= FloatToStr(V1[2]);
Edit42.Text:= FloatToStr(V1[3]);
Edit43.Text:= FloatToStr(V1[4]);
Edit44.Text:= FloatToStr(V1[5]);
Edit45.Text:= FloatToStr(V1[6]);
end else if Norm5(Error1) < Norm5(Error2) then begin
Product1:= ProductIs(Singular1, Original2, Specific, Singular2);
Edit1.Text:= FloatToStr(Product1[1]);
Edit2.Text:= FloatToStr(Product1[2]);
Edit3.Text:= FloatToStr(Product1[3]);
Edit4.Text:= FloatToStr(Product1[4]);
Edit5.Text:= FloatToStr(Product1[5]);
Product2:= ProductIs(Singular1, Compression, Expansion2,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V2:= Sum6(V2, Rationed(V2, V1, Error2, Error1));
Edit11.Text:= FloatToStr(V2[1]);
Edit12.Text:= FloatToStr(V2[2]);
Edit42.Text:= FloatToStr(V2[3]);
Edit43.Text:= FloatToStr(V2[4]);
Edit44.Text:= FloatToStr(V2[5]);
Edit45.Text:= FloatToStr(V2[6]);
end;
if Abs(Norm5(Error1)-Norm5(Error2)) < 1E-10 then begin
Timer2.Enabled:= False;
Timer4.Enabled:= False;
Button3.Enabled:= False;
Button5.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer3Timer(Sender: TObject);
var
Original1, Original2,
Compression1, Compression2,
Error1, Error2,
Product1, Product2: TVector5;
V1, V2: TVector3;

function Rationed(x1, x2: TVector3; E1, E2: TVector5): TVector3;
var
Det, Det1, Det2: Extended;
M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
sys: array[1..2, 1..2] of TVector5;
sys1: array[1..2] of TVector3;
begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum5(Ext5(M1[1,1], E1), Ext5(M1[1,2], E2));
sys[1,2]:= Sum5(Ext5(M1[2,1], E1), Ext5(M1[2,2], E2));
sys[2,1]:= Sum5(Ext5(M2[1,1], E1), Ext5(M2[1,2], E2));
sys[2,2]:= Sum5(Ext5(M2[2,1], E1), Ext5(M2[2,2], E2));

sys[1,1]:= Ext5(1/Norm5(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext5(1/Norm5(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext5(1/Norm5(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext5(1/Norm5(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc5(E1, sys[1,1]);
Coor1[1,2]:= Sc5(E1, sys[1,2]);
Coor1[2,1]:= Sc5(E1, sys[2,1]);
Coor1[2,2]:= Sc5(E1, sys[2,2]);

Coor2[1,1]:= Sc5(E2, sys[1,1]);
Coor2[1,2]:= Sc5(E2, sys[1,2]);
Coor2[2,1]:= Sc5(E2, sys[2,1]);
Coor2[2,2]:= Sc5(E2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;

repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
until M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1] <> 0;
//creating a vector5 system
sys1[1]:= Sum3(Ext3(M1[1,1], x1), Ext3(M1[1,2], x2));
sys1[2]:= Sum3(Ext3(M1[2,1], x1), Ext3(M1[2,2], x2));
//|sys[1,1]| = |sys[1,2]| = 1
sys1[1]:= Ext3(1/Norm3(sys1[1]), sys1[1]);
sys1[2]:= Ext3(1/Norm3(sys1[2]), sys1[2]);
//aquiring the 1d-coordinates for x1-x2
Coor1[1,1]:= Sc3(Dif3(x1, x2), sys1[1]);
Coor1[1,2]:= Sc3(Dif3(x1, x2), sys1[2]);
//rotation and shrinking by M
Coor1[2,1]:= M[1,1]*Coor1[1,1] + M[1,2]*Coor1[1,2];
Coor1[2,2]:= M[2,1]*Coor1[1,1] + M[2,2]*Coor1[1,2];
//summing
Result:= Sum3(Ext3(Coor1[2,1], sys1[1]),
Ext3(Coor1[2,2], sys1[2]));
end;

begin
Original1:= RNDOriginal; Compression1:= RNDCompression;
Error1:= Dif5(ProductIs(Singular1, Original1, Specific, Singular2),
ProductIs(Singular1, Compression1, Expansion,
Singular2));
Original2:= RNDOriginal; Compression2:= RNDCompression;
Error2:= Dif5(ProductIs(Singular1, Original2, Specific, Singular2),
ProductIs(Singular1, Compression2, Expansion,
Singular2));
V1[1]:= Original1[1]; V1[2]:= Original1[2]; V1[3]:= Compression1[1];
V2[1]:= Original2[1]; V2[2]:= Original2[2]; V2[3]:= Compression2[1];
Label2.Caption:= '|UpResult-DownResult| = ' +
FloatToStr(Norm5(Dif5(Error1, Error2)));
if Norm5(Error1) > Norm5(Error2) then begin
Product1:= ProductIs(Singular1, Original1, Specific, Singular2);
Edit1.Text:= FloatToStr(Product1[1]);
Edit2.Text:= FloatToStr(Product1[2]);
Edit3.Text:= FloatToStr(Product1[3]);
Edit4.Text:= FloatToStr(Product1[4]);
Edit5.Text:= FloatToStr(Product1[5]);
Product2:= ProductIs(Singular1, Compression1, Expansion,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V1:= Sum3(V2, Rationed(V1, V2, Error1, Error2));
Edit11.Text:= FloatToStr(V1[1]);
Edit12.Text:= FloatToStr(V1[2]);
Edit36.Text:= FloatToStr(V1[3]);
end else if Norm5(Error1) < Norm5(Error2) then begin
Product1:= ProductIs(Singular1, Original2, Specific, Singular2);
Edit1.Text:= FloatToStr(Product1[1]);
Edit2.Text:= FloatToStr(Product1[2]);
Edit3.Text:= FloatToStr(Product1[3]);
Edit4.Text:= FloatToStr(Product1[4]);
Edit5.Text:= FloatToStr(Product1[5]);
Product2:= ProductIs(Singular1, Compression2, Expansion,
Singular2);
Edit26.Text:= FloatToStr(Product2[1]);
Edit27.Text:= FloatToStr(Product2[2]);
Edit28.Text:= FloatToStr(Product2[3]);
Edit29.Text:= FloatToStr(Product2[4]);
Edit30.Text:= FloatToStr(Product2[5]);
V2:= Sum3(V2, Rationed(V2, V1, Error2, Error1));
Edit11.Text:= FloatToStr(V2[1]);
Edit12.Text:= FloatToStr(V2[2]);
Edit36.Text:= FloatToStr(V2[3]);
end;
if Abs(Norm5(Error1)-Norm5(Error2)) < 1E-10 then begin
Timer3.Enabled:= False;
Timer4.Enabled:= False;
Button4.Enabled:= False;
Button5.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer4Timer(Sender: TObject);
begin
EndingTime:= Now;
Label1.Caption:= 'Total time working: ' + DateTimeToStr(EndingTime -
StartingTime);
end;

end.

dedanoe

non lue,
5 mars 2008, 21:53:2605/03/2008
à
On Mar 3, 8:46 pm, dedanoe <deda...@gmail.com> wrote:


i re-wrote the entire program:
http://dedanoe.googlepages.com/Sponge_Comprexpander.zip
===source code===
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TVector3 = array[1..3] of Real;

TVector = array[1..5] of Real;

Timer4: TTimer;
Label2: TLabel;
procedure Timer3Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);


procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);

procedure Button4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }

end;

var
Form1: TForm1;
Singular1, Singular2,
Original, Specific,
Compression, Expansion,
ProductUp, ProductDown: TVector;
StartingTime, EndingTime: TDateTime;
pm1, pm2, Error1, Error2,
Product1, Product2,
Product11, Product21,
Product12, Product22: TVector;
pm1_3d, pm2_3d: TVector3;
pm1_6d, pm2_6d: TVector6;

implementation

{$R *.dfm}

function Norm(V: TVector): Real;


begin
Result:= Sqrt(Sqr(V[1])
+ Sqr(V[2])
+ Sqr(V[3])
+ Sqr(V[4])
+ Sqr(V[5]));
end;

function Sc(V1, V2: TVector): Real;


begin
Result:= V1[1] * V2[1]
+ V1[2] * V2[2]
+ V1[3] * V2[3]
+ V1[4] * V2[4]
+ V1[5] * V2[5];
end;

function Sum(V1, V2: TVector): TVector;


begin
Result[1]:= V1[1] + V2[1];
Result[2]:= V1[2] + V2[2];
Result[3]:= V1[3] + V2[3];
Result[4]:= V1[4] + V2[4];
Result[5]:= V1[5] + V2[5];
end;

function Ext(V1: Real; V2: TVector): TVector;


begin
Result[1]:= V1 * V2[1];
Result[2]:= V1 * V2[2];
Result[3]:= V1 * V2[3];
Result[4]:= V1 * V2[4];
Result[5]:= V1 * V2[5];
end;

function Dif(V1, V2: TVector): TVector;
begin
Result:= Sum(V1, Ext(-1, V2));
end;

function RNDSingular: TVector;


begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);

until Norm(Result) <> 0;
Result:= Ext(1/Norm(Result), Result);
end;

function RNDSpecific: TVector;


begin
Randomize;
repeat
Result[1]:= 1;
Result[2]:= 1;
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);

until Norm(Result) <> 0;
end;

function RNDOriginal: TVector;


begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 1;
Result[4]:= 1;
Result[5]:= 1;

until Norm(Result) <> 0;
end;

function RNDCompression: TVector;


begin
Randomize;
repeat
Result[1]:= 10 * (2 * Random - 1);
Result[2]:= 1;
Result[3]:= 1;
Result[4]:= 1;
Result[5]:= 1;

until Norm(Result) <> 0;
end;

function RNDExpansion: TVector;


begin
Randomize;
repeat
Result[1]:= 1;
Result[2]:= 10 * (2 * Random - 1);
Result[3]:= 10 * (2 * Random - 1);
Result[4]:= 10 * (2 * Random - 1);
Result[5]:= 10 * (2 * Random - 1);

until Norm(Result) <> 0;
end;

end;
1: begin
Compression:= RNDCompression;
Edit36.Text:= FloatToStr(Compression[1]);
Edit37.Text:= FloatToStr(Compression[2]);
Edit38.Text:= FloatToStr(Compression[3]);
Edit39.Text:= FloatToStr(Compression[4]);
Edit40.Text:= FloatToStr(Compression[5]);
Button2.Enabled:= False;
Button3.Enabled:= True;
Button4.Enabled:= False;

end;
2: begin
Expansion:= RNDExpansion;
Edit41.Text:= FloatToStr(Expansion[1]);
Edit42.Text:= FloatToStr(Expansion[2]);
Edit43.Text:= FloatToStr(Expansion[3]);
Edit44.Text:= FloatToStr(Expansion[4]);
Edit45.Text:= FloatToStr(Expansion[5]);
Button2.Enabled:= False;
Button3.Enabled:= False;
Button4.Enabled:= True;

end;
end;
end;

function Up1(O1, O2, S1, S2, S3: Real): Real;
begin
Result:= Singular1[2] * S2 * Singular2[5]
+ Singular1[3] * S3 * Singular2[1]
+ Singular1[4] * Singular2[2]
+ Singular1[5] * O1 * Specific[2] * Singular2[3]
- Singular2[2] * S1 * Singular1[5]
- Singular2[3] * S2 * Singular1[1]
- Singular2[4] * S3 * O1 * Singular1[2]
- Singular2[5] * O2 * Singular1[3];
end;

function Up2(O1, O2, S1, S2, S3: Real): Real;
begin
Result:= Singular1[3] * S3 * Singular2[1]
+ Singular1[4] * Singular2[2]
+ Singular1[5] * O1 * Singular2[3]
+ Singular1[1] * O2 * S1 * Singular2[4]
- Singular2[3] * S2 * Singular1[1]
- Singular2[4] * S3 * O1 * Singular1[2]
- Singular2[5] * O2 * Singular1[3]
- Singular2[1] * Singular1[4];
end;

function Up3(O1, O2, S1, S2, S3: Real): Real;
begin
Result:= Singular1[4] * Singular2[2]
+ Singular1[5] * O1 * Singular2[3]
+ Singular1[1] * O2 * S1 * Singular2[4]
+ Singular1[2] * S2 * Singular2[5]
- Singular2[4] * S3 * O1 * Singular1[2]
- Singular2[5] * O2 * Singular1[3]
- Singular2[1] * Singular1[4]
- Singular2[2] * S1 * Singular1[5];
end;

function Up4(O1, O2, S1, S2, S3: Real): Real;
begin
Result:= Singular1[5] * O1 * Singular2[3]
+ Singular1[1] * O2 * S1 * Singular2[4]
+ Singular1[2] * S2 * Singular2[5]
+ Singular1[3] * S3 * Singular2[1]
- Singular2[5] * O2 * Singular1[3]
- Singular2[1] * Singular1[4]
- Singular2[2] * S1 * Singular1[5]
- Singular2[3] * S2 * Singular1[1];
end;

function Up5(O1, O2, S1, S2, S3: Real): Real;
begin
Result:= Singular1[1] * O2 * S1 * Singular2[4]
+ Singular1[2] * S2 * Singular2[5]
+ Singular1[3] * S3 * Singular2[1]
+ Singular1[4] * Singular2[2]
- Singular2[1] * Singular1[4]
- Singular2[2] * S1 * Singular1[5]
- Singular2[3] * S2 * Singular1[1]
- Singular2[4] * S3 * O1 * Singular1[2];
end;

function Down1(C1, E1, E2, E3, E4: Real): Real;
begin
Result:= Singular1[2] * E3 * Singular2[5]
+ Singular1[3] * E4 * Singular2[1]
+ Singular1[4] * Singular2[2]
+ Singular1[5] * C1 * E1 * Singular2[3]
- Singular2[2] * E2 * Singular1[5]
- Singular2[3] * E3 * Singular1[1]
- Singular2[4] * E4 * C1 * Singular1[2]
- Singular2[5] * Singular1[3];
end;

function Down2(C1, E1, E2, E3, E4: Real): Real;
begin
Result:= Singular1[3] * E4 * Singular2[1]
+ Singular1[4] * Singular2[2]
+ Singular1[5] * C1 * E1 * Singular2[3]
+ Singular1[1] * E2 * Singular2[4]
- Singular2[3] * E3 * Singular1[1]
- Singular2[4] * E4 * C1 * Singular1[2]
- Singular2[5] * Singular1[3]
- Singular2[1] * E1 * Singular1[4];
end;

function Down3(C1, E1, E2, E3, E4: Real): Real;
begin
Result:= Singular1[4] * Singular2[2]
+ Singular1[5] * C1 * E1 * Singular2[3]
+ Singular1[1] * E2 * Singular2[4]
+ Singular1[2] * E3 * Singular2[5]
- Singular2[4] * E4 * C1 * Singular1[2]
- Singular2[5] * Singular1[3]
- Singular2[1] * E1 * Singular1[4]
- Singular2[2] * E2 * Singular1[5];
end;

function Down4(C1, E1, E2, E3, E4: Real): Real;
begin
Result:= Singular1[5] * C1 * E1 * Singular2[3]
+ Singular1[1] * E2 * Singular2[4]
+ Singular1[2] * E3 * Singular2[5]
+ Singular1[3] * E4 * Singular2[1]
- Singular2[5] * Singular1[3]
- Singular2[1] * E1 * Singular1[4]
- Singular2[2] * E2 * Singular1[5]
- Singular2[3] * E3 * Singular1[1];
end;

function Down5(C1, E1, E2, E3, E4: Real): Real;
begin
Result:= Singular1[1] * E2 * Singular2[4]
+ Singular1[2] * E3 * Singular2[5]
+ Singular1[3] * E4 * Singular2[1]
+ Singular1[4] * Singular2[2]
- Singular2[1] * E1 * Singular1[4]
- Singular2[2] * E2 * Singular1[5]
- Singular2[3] * E3 * Singular1[1]
- Singular2[4] * E4 * C1 * Singular1[2];
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ProductUp[1]:= Up1(Original[1], Original[2], Specific[3],
Specific[4], Specific[5]);
ProductUp[2]:= Up2(Original[1], Original[2], Specific[3],
Specific[4], Specific[5]);
ProductUp[3]:= Up3(Original[1], Original[2], Specific[3],
Specific[4], Specific[5]);
ProductUp[4]:= Up4(Original[1], Original[2], Specific[3],
Specific[4], Specific[5]);
ProductUp[5]:= Up5(Original[1], Original[2], Specific[3],
Specific[4], Specific[5]);
Edit1.Text:= FloatToStr(ProductUp[1]);
Edit2.Text:= FloatToStr(ProductUp[2]);
Edit3.Text:= FloatToStr(ProductUp[3]);
Edit4.Text:= FloatToStr(ProductUp[4]);
Edit5.Text:= FloatToStr(ProductUp[5]);
pm1[1]:= 10 * (Random - 0.5);
pm1[2]:= 10 * (Random - 0.5);
pm1[3]:= 10 * (Random - 0.5);
pm1[4]:= 10 * (Random - 0.5);
pm1[5]:= 10 * (Random - 0.5);
pm2[1]:= 10 * (Random - 0.5);
pm2[2]:= 10 * (Random - 0.5);
pm2[3]:= 10 * (Random - 0.5);
pm2[4]:= 10 * (Random - 0.5);
pm2[5]:= 10 * (Random - 0.5);
Button1.Enabled:= False;


Timer1.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
pm1_6d[1]:= 10 * (Random - 0.5);
pm1_6d[2]:= 10 * (Random - 0.5);
pm1_6d[3]:= 10 * (Random - 0.5);
pm1_6d[4]:= 10 * (Random - 0.5);
pm1_6d[5]:= 10 * (Random - 0.5);
pm1_6d[6]:= 10 * (Random - 0.5);
pm2_6d[1]:= 10 * (Random - 0.5);
pm2_6d[2]:= 10 * (Random - 0.5);
pm2_6d[3]:= 10 * (Random - 0.5);
pm2_6d[4]:= 10 * (Random - 0.5);
pm2_6d[5]:= 10 * (Random - 0.5);
pm2_6d[6]:= 10 * (Random - 0.5);
Button1.Enabled:= False;


Timer2.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
pm1_3d[1]:= 10 * (Random - 0.5);
pm1_3d[2]:= 10 * (Random - 0.5);
pm1_3d[3]:= 10 * (Random - 0.5);
pm2_3d[1]:= 10 * (Random - 0.5);
pm2_3d[2]:= 10 * (Random - 0.5);
pm2_3d[3]:= 10 * (Random - 0.5);
Button1.Enabled:= False;


Timer3.Enabled:= True;
Timer4.Enabled:= True;
StartingTime:= Now;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var pm: TVector;

function Ration(x1, x2, y1, y2: TVector): TVector;


var Det, Det1, Det2: Extended;

var M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
var sys: array[1..2, 1..2] of TVector;


begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum(Ext(M1[1,1], y1), Ext(M1[1,2], y2));
sys[1,2]:= Sum(Ext(M1[2,1], y1), Ext(M1[2,2], y2));
sys[2,1]:= Sum(Ext(M2[1,1], y1), Ext(M2[1,2], y2));
sys[2,2]:= Sum(Ext(M2[2,1], y1), Ext(M2[2,2], y2));

sys[1,1]:= Ext(1/Norm(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext(1/Norm(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext(1/Norm(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext(1/Norm(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc(y1, sys[1,1]);
Coor1[1,2]:= Sc(y1, sys[1,2]);
Coor1[2,1]:= Sc(y1, sys[2,1]);
Coor1[2,2]:= Sc(y1, sys[2,2]);

Coor2[1,1]:= Sc(y2, sys[1,1]);
Coor2[1,2]:= Sc(y2, sys[1,2]);
Coor2[2,1]:= Sc(y2, sys[2,1]);
Coor2[2,2]:= Sc(y2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;


repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;

Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];

until Det1 <> 0;

sys[1,1]:= Sum(Ext(M1[1,1], x1), Ext(M1[1,2], x2));
sys[1,2]:= Sum(Ext(M1[2,1], x1), Ext(M1[2,2], x2));
sys[1,1]:= Ext(1/Norm(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext(1/Norm(sys[1,2]), sys[1,2]);
coor1[1,1]:= Sc(sys[1,1], Dif(x1,x2));
coor1[1,2]:= Sc(sys[1,2], Dif(x1,x2));
coor1[2,1]:= M[1,1]*coor1[1,1]+M[1,2]*coor1[1,2];
coor1[2,2]:= M[2,1]*coor1[1,1]+M[2,2]*coor1[1,2];
Result:= Sum(Ext(coor1[2,1], sys[1,1]),
Ext(coor1[2,2], sys[1,2]));
end;

begin
Product1[1]:= Down1(pm1[1], pm1[2], pm1[3], pm1[4], pm1[5]);
Product1[2]:= Down2(pm1[1], pm1[2], pm1[3], pm1[4], pm1[5]);
Product1[3]:= Down3(pm1[1], pm1[2], pm1[3], pm1[4], pm1[5]);
Product1[4]:= Down4(pm1[1], pm1[2], pm1[3], pm1[4], pm1[5]);
Product1[5]:= Down5(pm1[1], pm1[2], pm1[3], pm1[4], pm1[5]);
Error1:= Dif(Product1, ProductUp);
Product2[1]:= Down1(pm2[1], pm2[2], pm2[3], pm2[4], pm2[5]);
Product2[2]:= Down2(pm2[1], pm2[2], pm2[3], pm2[4], pm2[5]);
Product2[3]:= Down3(pm2[1], pm2[2], pm2[3], pm2[4], pm2[5]);
Product2[4]:= Down4(pm2[1], pm2[2], pm2[3], pm2[4], pm2[5]);
Product2[5]:= Down5(pm2[1], pm2[2], pm2[3], pm2[4], pm2[5]);
Error2:= Dif(Product2, ProductUp);
if Norm(Error1) > Norm(Error2) then begin
Compression[1]:= pm1[1]; pm1[1]:= pm2[1]; pm2[1]:= Compression[1];
Expansion[2]:= pm1[2]; pm1[2]:= pm2[2]; pm2[2]:= Expansion[2];
Expansion[3]:= pm1[3]; pm1[3]:= pm2[3]; pm2[3]:= Expansion[3];
Expansion[4]:= pm1[4]; pm1[4]:= pm2[4]; pm2[4]:= Expansion[4];
Expansion[5]:= pm1[5]; pm1[5]:= pm2[5]; pm2[5]:= Expansion[5];
Error1:= Dif(Product2, ProductUp); Error2:= Dif(Product1,
ProductUp);
end;


Label2.Caption:= '|UpResult-DownResult| = ' +

FloatToStr(Norm(Dif(Product1, ProductUp)));
if Norm(Dif(pm1, pm2)) > 1E-18 then begin
pm:= Dif(pm1, Ration(pm1, pm2, Error1, Error2));
pm2:= pm1; pm1:= pm;
Edit36.Text:= FloatToStr(pm1[1]);
Edit42.Text:= FloatToStr(pm1[2]);
Edit43.Text:= FloatToStr(pm1[3]);
Edit44.Text:= FloatToStr(pm1[4]);
Edit45.Text:= FloatToStr(pm1[5]);
Edit26.Text:= FloatToStr(Product1[1]);
Edit27.Text:= FloatToStr(Product1[2]);
Edit28.Text:= FloatToStr(Product1[3]);
Edit29.Text:= FloatToStr(Product1[4]);
Edit30.Text:= FloatToStr(Product1[5]);
end else begin


Timer1.Enabled:= False;
Timer4.Enabled:= False;

Button1.Enabled:= True;
Button2.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
var pm: TVector6;

function Ration(x1, x2: TVector6; y1, y2: TVector): TVector6;


var Det, Det1, Det2: Extended;

var M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
var sys: array[1..2, 1..2] of TVector;
var sys6: array[1..2] of TVector6;


begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum(Ext(M1[1,1], y1), Ext(M1[1,2], y2));
sys[1,2]:= Sum(Ext(M1[2,1], y1), Ext(M1[2,2], y2));
sys[2,1]:= Sum(Ext(M2[1,1], y1), Ext(M2[1,2], y2));
sys[2,2]:= Sum(Ext(M2[2,1], y1), Ext(M2[2,2], y2));

sys[1,1]:= Ext(1/Norm(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext(1/Norm(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext(1/Norm(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext(1/Norm(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc(y1, sys[1,1]);
Coor1[1,2]:= Sc(y1, sys[1,2]);
Coor1[2,1]:= Sc(y1, sys[2,1]);
Coor1[2,2]:= Sc(y1, sys[2,2]);

Coor2[1,1]:= Sc(y2, sys[1,1]);
Coor2[1,2]:= Sc(y2, sys[1,2]);
Coor2[2,1]:= Sc(y2, sys[2,1]);
Coor2[2,2]:= Sc(y2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;


repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;

Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];

until Det1 <> 0;

sys6[1]:= Sum6(Ext6(M1[1,1], x1), Ext6(M1[1,2], x2));
sys6[2]:= Sum6(Ext6(M1[2,1], x1), Ext6(M1[2,2], x2));
sys6[1]:= Ext6(1/Norm6(sys6[1]), sys6[1]);
sys6[2]:= Ext6(1/Norm6(sys6[2]), sys6[2]);
coor1[1,1]:= Sc6(sys6[1], Dif6(x1,x2));
coor1[1,2]:= Sc6(sys6[2], Dif6(x1,x2));
coor1[2,1]:= M[1,1]*coor1[1,1]+M[1,2]*coor1[1,2];
coor1[2,2]:= M[2,1]*coor1[1,1]+M[2,2]*coor1[1,2];
Result:= Sum6(Ext6(coor1[2,1], sys6[1]),
Ext6(coor1[2,2], sys6[2]));
end;

begin
Product11[1]:= Up1(pm1_6d[1], pm1_6d[2], Specific[3], Specific[4],
Specific[5]);
Product11[2]:= Up2(pm1_6d[1], pm1_6d[2], Specific[3], Specific[4],
Specific[5]);
Product11[3]:= Up3(pm1_6d[1], pm1_6d[2], Specific[3], Specific[4],
Specific[5]);
Product11[4]:= Up4(pm1_6d[1], pm1_6d[2], Specific[3], Specific[4],
Specific[5]);
Product11[5]:= Up5(pm1_6d[1], pm1_6d[2], Specific[3], Specific[4],
Specific[5]);
Product12[1]:= Down1(Compression[1], pm1_6d[3], pm1_6d[4],
pm1_6d[5], pm1_6d[6]);
Product12[2]:= Down2(Compression[1], pm1_6d[3], pm1_6d[4],
pm1_6d[5], pm1_6d[6]);
Product12[3]:= Down3(Compression[1], pm1_6d[3], pm1_6d[4],
pm1_6d[5], pm1_6d[6]);
Product12[4]:= Down4(Compression[1], pm1_6d[3], pm1_6d[4],
pm1_6d[5], pm1_6d[6]);
Product12[5]:= Down5(Compression[1], pm1_6d[3], pm1_6d[4],
pm1_6d[5], pm1_6d[6]);
Error1:= Dif(Product11, Product12);
Product21[1]:= Up1(pm2_6d[1], pm2_6d[2], Specific[3], Specific[4],
Specific[5]);
Product21[2]:= Up2(pm2_6d[1], pm2_6d[2], Specific[3], Specific[4],
Specific[5]);
Product21[3]:= Up3(pm2_6d[1], pm2_6d[2], Specific[3], Specific[4],
Specific[5]);
Product21[4]:= Up4(pm2_6d[1], pm2_6d[2], Specific[3], Specific[4],
Specific[5]);
Product21[5]:= Up5(pm2_6d[1], pm2_6d[2], Specific[3], Specific[4],
Specific[5]);
Product22[1]:= Down1(Compression[1], pm2_6d[3], pm2_6d[4],
pm2_6d[5], pm2_6d[6]);
Product22[2]:= Down2(Compression[1], pm2_6d[3], pm2_6d[4],
pm2_6d[5], pm2_6d[6]);
Product22[3]:= Down3(Compression[1], pm2_6d[3], pm2_6d[4],
pm2_6d[5], pm2_6d[6]);
Product22[4]:= Down4(Compression[1], pm2_6d[3], pm2_6d[4],
pm2_6d[5], pm2_6d[6]);
Product22[5]:= Down5(Compression[1], pm2_6d[3], pm2_6d[4],
pm2_6d[5], pm2_6d[6]);
Error2:= Dif(Product21, Product22);
if Norm(Error1) > Norm(Error2) then begin
Original[1]:= pm1_6d[1]; pm1_6d[1]:= pm2_6d[1]; pm2_6d[1]:=
Original[1];
Original[2]:= pm1_6d[2]; pm1_6d[2]:= pm2_6d[2]; pm2_6d[2]:=
Original[2];
Expansion[2]:= pm1_6d[3]; pm1_6d[3]:= pm2_6d[3]; pm2_6d[3]:=
Expansion[2];
Expansion[3]:= pm1_6d[4]; pm1_6d[4]:= pm2_6d[4]; pm2_6d[4]:=
Expansion[3];
Expansion[4]:= pm1_6d[5]; pm1_6d[5]:= pm2_6d[5]; pm2_6d[5]:=
Expansion[4];
Expansion[5]:= pm1_6d[6]; pm1_6d[6]:= pm2_6d[6]; pm2_6d[6]:=
Expansion[5];
Error1:= Dif(Product21, Product22); Error2:= Dif(Product11,
Product12);
end;


Label2.Caption:= '|UpResult-DownResult| = ' +

FloatToStr(Norm(Dif(Product11, Product12)));
if Norm6(Dif6(pm1_6d, pm2_6d)) > 1E-18 then begin
pm:= Dif6(pm1_6d, Ration(pm1_6d, pm2_6d, Error1, Error2));
pm2_6d:= pm1_6d; pm1_6d:= pm;
Edit11.Text:= FloatToStr(pm1_6d[1]);
Edit12.Text:= FloatToStr(pm1_6d[2]);
Edit42.Text:= FloatToStr(pm1_6d[3]);
Edit43.Text:= FloatToStr(pm1_6d[4]);
Edit44.Text:= FloatToStr(pm1_6d[5]);
Edit45.Text:= FloatToStr(pm1_6d[6]);
Edit1.Text:= FloatToStr(Product11[1]);
Edit2.Text:= FloatToStr(Product11[2]);
Edit3.Text:= FloatToStr(Product11[3]);
Edit4.Text:= FloatToStr(Product11[4]);
Edit5.Text:= FloatToStr(Product11[5]);
Edit26.Text:= FloatToStr(Product12[1]);
Edit27.Text:= FloatToStr(Product12[2]);
Edit28.Text:= FloatToStr(Product12[3]);
Edit29.Text:= FloatToStr(Product12[4]);
Edit30.Text:= FloatToStr(Product12[5]);
end else begin


Timer1.Enabled:= False;
Timer4.Enabled:= False;

Button1.Enabled:= True;
Button2.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer3Timer(Sender: TObject);
var pm: TVector3;

function Ration(x1, x2: TVector3; y1, y2: TVector): TVector3;


var Det, Det1, Det2: Extended;

var M, M1, M2, Coor1, Coor2: array[1..2, 1..2] of Extended;
var sys: array[1..2, 1..2] of TVector;
var sys3: array[1..3] of TVector3;


begin
repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;
Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];
M2[1,1]:= Random - 0.5;
M2[1,2]:= Random - 0.5;
M2[2,1]:= Random - 0.5;
M2[2,2]:= Random - 0.5;
Det2:= M2[1, 1]*M2[2, 2] - M2[1, 2]*M2[2, 1];
until Det1 * Det2 <> 0;

sys[1,1]:= Sum(Ext(M1[1,1], y1), Ext(M1[1,2], y2));
sys[1,2]:= Sum(Ext(M1[2,1], y1), Ext(M1[2,2], y2));
sys[2,1]:= Sum(Ext(M2[1,1], y1), Ext(M2[1,2], y2));
sys[2,2]:= Sum(Ext(M2[2,1], y1), Ext(M2[2,2], y2));

sys[1,1]:= Ext(1/Norm(sys[1,1]), sys[1,1]);
sys[1,2]:= Ext(1/Norm(sys[1,2]), sys[1,2]);
sys[2,1]:= Ext(1/Norm(sys[2,1]), sys[2,1]);
sys[2,2]:= Ext(1/Norm(sys[2,2]), sys[2,2]);

Coor1[1,1]:= Sc(y1, sys[1,1]);
Coor1[1,2]:= Sc(y1, sys[1,2]);
Coor1[2,1]:= Sc(y1, sys[2,1]);
Coor1[2,2]:= Sc(y1, sys[2,2]);

Coor2[1,1]:= Sc(y2, sys[1,1]);
Coor2[1,2]:= Sc(y2, sys[1,2]);
Coor2[2,1]:= Sc(y2, sys[2,1]);
Coor2[2,2]:= Sc(y2, sys[2,2]);

Det:= Coor2[1,1]*Coor2[2,2] - Coor2[1,2]*Coor2[2,1];

M[1,1]:= (Coor1[1,1]*Coor2[2,2] - Coor1[1,2]*Coor2[2,1])/Det;
M[1,2]:= (Coor2[1,1]*Coor1[1,2] - Coor2[1,2]*Coor1[1,1])/Det;
M[2,1]:= (Coor1[2,1]*Coor2[2,2] - Coor1[2,2]*Coor2[2,1])/Det;
M[2,2]:= (Coor2[1,1]*Coor1[2,2] - Coor2[1,2]*Coor1[2,1])/Det;


repeat
M1[1,1]:= Random - 0.5;
M1[1,2]:= Random - 0.5;
M1[2,1]:= Random - 0.5;
M1[2,2]:= Random - 0.5;

Det1:= M1[1, 1]*M1[2, 2] - M1[1, 2]*M1[2, 1];

until Det1 <> 0;

sys3[1]:= Sum3(Ext3(M1[1,1], x1), Ext3(M1[1,2], x2));
sys3[2]:= Sum3(Ext3(M1[2,1], x1), Ext3(M1[2,2], x2));
sys3[1]:= Ext3(1/Norm3(sys3[1]), sys3[1]);
sys3[2]:= Ext3(1/Norm3(sys3[2]), sys3[2]);
coor1[1,1]:= Sc3(sys3[1], Dif3(x1,x2));
coor1[1,2]:= Sc3(sys3[2], Dif3(x1,x2));
coor1[2,1]:= M[1,1]*coor1[1,1]+M[1,2]*coor1[1,2];
coor1[2,2]:= M[2,1]*coor1[1,1]+M[2,2]*coor1[1,2];
Result:= Sum3(Ext3(coor1[2,1], sys3[1]),
Ext3(coor1[2,2], sys3[2]));
end;

begin
Product11[1]:= Up1(pm1_3d[1], pm1_3d[2], Specific[3], Specific[4],
Specific[5]);
Product11[2]:= Up2(pm1_3d[1], pm1_3d[2], Specific[3], Specific[4],
Specific[5]);
Product11[3]:= Up3(pm1_3d[1], pm1_3d[2], Specific[3], Specific[4],
Specific[5]);
Product11[4]:= Up4(pm1_3d[1], pm1_3d[2], Specific[3], Specific[4],
Specific[5]);
Product11[5]:= Up5(pm1_3d[1], pm1_3d[2], Specific[3], Specific[4],
Specific[5]);
Product12[1]:= Down1(pm1_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product12[2]:= Down2(pm1_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product12[3]:= Down3(pm1_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product12[4]:= Down4(pm1_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product12[5]:= Down5(pm1_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Error1:= Dif(Product11, Product12);
Product21[1]:= Up1(pm2_3d[1], pm2_3d[2], Specific[3], Specific[4],
Specific[5]);
Product21[2]:= Up2(pm2_3d[1], pm2_3d[2], Specific[3], Specific[4],
Specific[5]);
Product21[3]:= Up3(pm2_3d[1], pm2_3d[2], Specific[3], Specific[4],
Specific[5]);
Product21[4]:= Up4(pm2_3d[1], pm2_3d[2], Specific[3], Specific[4],
Specific[5]);
Product21[5]:= Up5(pm2_3d[1], pm2_3d[2], Specific[3], Specific[4],
Specific[5]);
Product22[1]:= Down1(pm2_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product22[2]:= Down2(pm2_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product22[3]:= Down3(pm2_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product22[4]:= Down4(pm2_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Product22[5]:= Down5(pm2_3d[3], Expansion[2], Expansion[3],
Expansion[4], Expansion[5]);
Error2:= Dif(Product21, Product22);
if Norm(Error1) > Norm(Error2) then begin
Original[1]:= pm1_3d[1]; pm1_3d[1]:= pm2_3d[1]; pm2_3d[1]:=
Original[1];
Original[2]:= pm1_3d[2]; pm1_3d[2]:= pm2_3d[2]; pm2_3d[2]:=
Original[2];
Compression[1]:= pm1_3d[3]; pm1_3d[3]:= pm2_3d[3]; pm2_3d[3]:=
Compression[1];
Error1:= Dif(Product21, Product22); Error2:= Dif(Product11,
Product12);
end;


Label2.Caption:= '|UpResult-DownResult| = ' +

FloatToStr(Norm(Dif(Product11, Product12)));
if Norm3(Dif3(pm1_3d, pm2_3d)) > 1E-18 then begin
pm:= Dif3(pm1_3d, Ration(pm1_3d, pm2_3d, Error1, Error2));
pm2_3d:= pm1_3d; pm1_3d:= pm;
Edit11.Text:= FloatToStr(pm1_3d[1]);
Edit12.Text:= FloatToStr(pm1_3d[2]);
Edit36.Text:= FloatToStr(pm1_3d[3]);
Edit1.Text:= FloatToStr(Product11[1]);
Edit2.Text:= FloatToStr(Product11[2]);
Edit3.Text:= FloatToStr(Product11[3]);
Edit4.Text:= FloatToStr(Product11[4]);
Edit5.Text:= FloatToStr(Product11[5]);
Edit26.Text:= FloatToStr(Product12[1]);
Edit27.Text:= FloatToStr(Product12[2]);
Edit28.Text:= FloatToStr(Product12[3]);
Edit29.Text:= FloatToStr(Product12[4]);
Edit30.Text:= FloatToStr(Product12[5]);
end else begin


Timer1.Enabled:= False;
Timer4.Enabled:= False;

Button1.Enabled:= True;
Button2.Enabled:= False;
Beep;
end;
end;

procedure TForm1.Timer4Timer(Sender: TObject);
begin
EndingTime:= Now;

Label1.Caption:= 'Total working time: ' + TimeToStr(EndingTime -
StartingTime);
end;

end.

0 nouveau message