public Part3(Part1 table, Part2 data) { Lymbda = 1 / data.Xв; Xi = new int[table.k]; Xi1 = new int[table.k]; ni = new int[table.k]; zi = new double[table.k]; zi1 = new double[table.k]; E_zi = new double[table.k]; E_zi1 = new double[table.k]; pi = new double[table.k]; npi = new double[table.k]; Component = new double[table.k]; for (var index = 0; index < table.k; index++) { Xi[index] = index * table.h; Xi1[index] = (index + 1) * table.h; ni[index] = table.Ni[index]; zi[index] = Math.Round(Lymbda * Xi[index], 2); zi1[index] = Math.Round(Lymbda * Xi1[index], 2); E_zi[index] = Math.Round(Math.Pow(Math.E, -zi[index]), 4); E_zi1[index] = Math.Round(Math.Pow(Math.E, -zi1[index]), 4); pi[index] = Math.Round(E_zi[index] - E_zi1[index], 4); npi[index] = Math.Round(pi[index] * table.Count, 2); Component[index] = Math.Round(Math.Pow(ni[index] - npi[index], 2) / npi[index], 3); X2набл += Math.Round(Component[index], 2); } }
public static void PrintPart1(Part1 part1) { PrintRow(part1.Ii); PrintRow(part1.Ni); PrintRow(part1.Wi); PrintRow(part1.Bi); PrintRow(part1.Xi); Console.WriteLine(); }
public static void PrintPart3(Part1 part1, Part3 part3) { for (var i = 0; i < part1.k; ++i) { PrintRowTrans(part3, i); } Console.WriteLine("X2набл: {0}", part3.X2набл); Console.WriteLine(); }
private static void Solution(double[] data) { if (data.Length != 100) { Console.WriteLine("The sample must be a hundred items"); return; } var table = new Part1(data); PrintResult.PrintPart1(table); var part2 = new Part2(table); PrintResult.PrintPart2(part2); var part3 = new Part3(table, part2); PrintResult.PrintPart3(table, part3); }
public Part2(Part1 part1) { for (var index = 0; index < part1.k; ++index) { M1 += part1.Xi[index] * part1.Wi[index]; M2 += Math.Pow(part1.Xi[index], 2) * part1.Wi[index]; M3 += Math.Pow(part1.Xi[index], 3) * part1.Wi[index]; M4 += Math.Pow(part1.Xi[index], 4) * part1.Wi[index]; } m2 = M2 - Math.Pow(M1, 2); m3 = M3 - 3 * M2 * M1 + 2 * Math.Pow(M1, 3); m4 = M4 - 4 * M3 * M1 + 6 * M2 * Math.Pow(M1, 2) - 3 * Math.Pow(M1, 4); Xв = M1; Dв = m2; Бв = Math.Sqrt(Dв); As = m3 / Math.Pow(Бв, 3); Ex = m4 / Math.Pow(Бв, 4) - 3; V = Бв / Xв; }