using System;
using System.Collections.Generic;
using System.Text;
namespace Законы_распределения.Распределения
{
public class Processing
{
private Распределения.OutValues ouVal;
private Распределения.EnterValues enVal;
private Распределения.Functoins Func;
private Распределения.SwitchOn sOn;
private double[] arF;
public Processing(Распределения.OutValues ouVal, Распределения.EnterValues enVal,
Распределения.Functoins Func, Распределения.SwitchOn sOn)
{
this.ouVal = ouVal;
this.enVal = enVal;
this.Func = Func;
this.sOn = sOn;
}
public void Calculation()
{
double Int = (Math.Abs(Func.maxX(ouVal._arX)) + Math.Abs(Func.minX(ouVal._arX))) / (double)enVal._Ntb;
double sumInt = Func.minX(ouVal._arX);
ouVal._arTable = new double[enVal._Ntb, 7];
arF = new double[enVal._Ntb];
for (int i = 0; i < enVal._Ntb; i++)
{
ouVal._arTable[i, 0] = i + 1;
sumInt += Int;
ouVal._arTable[i, 1] = sumInt;
for (int j = 0; j < enVal._N; j++)
{
if (ouVal._arTable[i, 1] - Int <= ouVal._arX[j] && ouVal._arX[j] < ouVal._arTable[i, 1])
{
ouVal._arTable[i, 2]++;
}
}
ouVal._arTable[i, 4] = ouVal._arTable[i, 2] / (double)enVal._N;
findF(Int);
ouVal._arTable[i, 5] = arF[i];
ouVal._arTable[i, 3] = ouVal._arTable[i, 5] * (double)enVal._N;
ouVal._arTable[i, 6] = Func.Xi2(i);
}
ouVal._MatO = Func.MatOX();
ouVal._Disp = Func.DispX(ouVal._MatO);
ouVal._Sko = Func.SkoX(ouVal._Disp);
ouVal._Xi2 = Func.sumXi2(ouVal._arTable);
//
ouVal._Sko_T = Math.Sqrt(ouVal._Disp_T);
//
ouVal._maxfFR = Func.maxFR();
//
Totals();
}
private void findF(double Int)
{
double[] arChG;
int nG = 1;
switch(sOn._rdChoice)
{
case 10://Равномерное
{
for (int i = 0; i < enVal._Ntb; i++)
{
arF[i] = Func.fR(Int, i);
}
Func.varR_T();
break;
}
case 11://Нормальное
{
for (int i = 0; i < enVal._Ntb; i++)
{
arF[i] = Func.fNorm(Int, i);
}
Func.varNorm_T();
break;
}
}
}
public void Totals()
{
ouVal._sumInt = 0;
ouVal._sumNi = 0;
ouVal._sumNi_T = 0;
ouVal._sumCha = 0;
ouVal._sumCha_T = 0;
ouVal._sumXi2 = 0;
for (int i = 0; i < enVal._Ntb; i++)
{
ouVal._sumInt += ouVal._arTable[i, 1];
ouVal._sumNi += (int)(ouVal._arTable[i, 2]);
ouVal._sumNi_T += ouVal._arTable[i, 3];
ouVal._sumCha += ouVal._arTable[i, 4];
ouVal._sumCha_T += ouVal._arTable[i, 5];
ouVal._sumXi2 += ouVal._arTable[i, 6];
}
}
}
}