Использование современной компьютерной техники и программного обеспечения для определения зависимости температуры раствора от величины pH раствора, страница 9

      Begin

         For i:=1 to n do S:=S + sqr(Matrix[1,i]);

         Summ:=S;

      End;

End; {Function}

Procedure Sred_GroupXY;

Begin

   For i:=1 to 6 do Sred_GroupX:=Sred_GroupX+Sered_intX[1,i]*Nxi[1,i];

   Sred_GroupX:=Sred_GroupX/n;

   For j:=1 to 6 do Sred_GroupY:=Sred_GroupY+Sered_intY[j,1]*Nyj[j,1];

   Sred_GroupY:=Sred_GroupY/n;

End;

Procedure SredXY;

Begin

   For i:=1 to n do SredX:=SredX+Matrix[1,i];

   SredX:=SredX/n;

   For i:=1 to n do SredY:=SredY+Matrix[2,i];

   SredY:=SredY/n;

End;

Procedure SxSy(Key:String);

Begin

   If Key='Group'

   Then

      Begin

         Sx:=0;Sy:=0;

         For i:=1 to 6 do Sx:=Sx+Sqr(Sered_intX[1,i]-Sred_GroupX)*Nxi[1,i];

         Sx:=Sqrt(Sx/n);

         For j:=1 to 6 do Sy:=Sy+Sqr(Sered_intY[j,1]-Sred_GroupY)*Nyj[j,1];

         Sy:=Sqrt(Sy/n);

      End

   Else If Key='No_Group' then

      Begin

         Sx:=0;Sy:=0;

         For i:=1 to n do Sx:=Sx+sqr(Matrix[1,i]-SredX);

         Sx:=Sqrt(Sx/n);

         For i:=1 to n do Sy:=Sy+sqr(Matrix[2,i]-SredY);

         Sy:=Sqrt(Sy/n);

      End;

End;

Procedure Koef_Group_R;

Begin

   For i:=1 to 6 do

      For j:=1 to 6 do Sum1:=Sum1+((Sered_intX[1,i]-Sred_GroupX)*(Sered_intY[j,1]-Sred_GroupY))*Table[j,i];

   For i:=1 to 6 do Sum2:=Sum2+Sqr(Sered_intX[1,i]-Sred_GroupX)*Nxi[1,i];

   Sum2:=Sqrt(Sum2);

   For j:=1 to 6 do Sum3:=Sum3+Sqr(Sered_intY[j,1]-Sred_GroupY)*Nyj[j,1];

   Sum3:=Sqrt(Sum3);

   R_Group:=Sum1/(Sum2*Sum3);

End;

Procedure Koef_No_Group_R;

Begin

   Sum1:=0;Sum2:=0;Sum3:=0;

   For i:= 1 to n do Sum1:=Sum1+(Matrix[1,i]-SredX)*(Matrix[2,i]-SredY);

   For i:=1 to n do Sum2:=Sum2+sqr(Matrix[1,i]-SredX);

   Sum2:=Sqrt(Sum2);

   For i:=1 to n do Sum3:=Sum3+sqr(Matrix[2,i]-SredY);

   Sum3:=Sqrt(Sum3);

   R:=Sum1/(Sum2*Sum3);

End;

Begin

{------------------Чтение из файла----------------------------------------}

   Assign(File_Input,Road_Input);

   Reset(File_Input);

   i:=1;

   Readln(File_Input);   {Пропуск строки в файле}

   While not EOF(File_Input) do

   Begin {While}

      Read(File_Input,Matrix[1,i]);

      Readln(File_Input,Matrix[2,i]);

      i:=i+1;

   End; {While}

   Close(File_Input);

{--------------------Составление корреляционной таблицы-------------------}

   Program_Table;  {Подпрограмма вычисления корреляционной таблицы}

{--------------------Вычисление середин интервалов------------------------}

   Sered_intX[1,1]:=X_Min+Hx/2;

   For i:=2 to 6 do Sered_intX[1,i]:=Sered_intX[1,i-1]+Hx;

   Sered_intY[1,1]:=Y_Max-Hy/2;

   For j:=2 to 6 do Sered_intY[j,1]:=Sered_intY[j-1,1]-Hy;

{--------------------Вычисление Nxi и Nyj---------------------------------}

   For i:=1 to 6 do

   Begin

      For j:=1 to k do Nxi[1,i]:=Nxi[1,i]+Table[j,i];

   End;

   For j:=1 to 6 do

   Begin

      For i:=1 to 6 do Nyj[j,1]:=Nyj[j,1]+Table[j,i];

   End;

{---------------------Вычисление условных средних значений----------------}

   For i:=1 to 6 do

   Begin

      For j:=1 to 6 do UsZnach_YXi[1,i]:=UsZnach_YXi[1,i]+Sered_intY[j,1]*Table[j,i];

      UsZnach_YXi[1,i]:=UsZnach_YXi[1,i]/Nxi[1,i];

   End;

   For j:=1 to 6 do

   Begin

      For i:=1 to 6 do UsZnach_XYj[j,1]:=UsZnach_XYj[j,1]+Sered_intX[1,i]*Table[j,i];

      UsZnach_XYj[j,1]:=UsZnach_XYj[j,1]/Nyj[j,1];

   End;

{----------Вывод на печать корреляционной таблицы-------------------------}

   Assign(File_Table,Road_Table);

   Rewrite(File_Table);

   Writeln(File_Table,'       Корреляционная таблица ');

   Write(File_Table,'        ');

   For i:=1 to k do Write(File_Table,Sered_intX[1,i]:5:3,'   ');

   Writeln(File_Table);

   For i:=1 to 83 do Write(File_Table,'-');

   Writeln(File_Table);

   For j:=1 to k do

   Begin

      Write(File_Table,Sered_intY[j,1]:5:3,' | ');

      For i:=1 to k do

      Begin

         Write(File_Table,'   ');

         Write(File_Table,Table[j,i],'      ');

      End;

      Write(File_Table,' |  ',Nyj[j,1],' | ');

      Write(File_Table,UsZnach_XYj[j,1]:5:3);

      Writeln(File_Table);

   End;

   For i:=1 to 83 do Write(File_Table,'-');