static void Main(string[] args) { var NormalDG = new NormalDG(); var ExponentialDG = new ExponentialDG(); var LogisticDG = new LogisticDG(); var CauchyDG = new CauchyDG(); var StudentsDG = new StudentsDG(); string Format(double val) { return(string.Format("{0:0.###}", val)); } double[] PrintDGMainInfo(DistributionGenerator dg, string dg_name) { var arr = dg.GenerateSequence(); if (dg.GetType() != typeof(CauchyDG)) { DistributionGenerator.GetRealExpectedValueAndDispersion(arr, out double expval, out double disp); Console.WriteLine($"[{dg_name}] \n" + $"Expected value: {Format(dg.ExpectedValue)} Real: {Format(expval)}\n" + $"Dispersion: {Format(dg.Dispersion)} Real: {Format(disp)}\n\n"); } else { CauchyDG cauchyDG = (CauchyDG)dg; Console.WriteLine($"[{dg_name}] \n" + $"Selective median: {Format(CauchyDG.SMV)} Real: {Format(cauchyDG.CalculateSMV(arr))}\n\n"); } return(arr); } Console.WriteLine("[==================[Main task]==================]"); PrintDGMainInfo(NormalDG, "NormalDG"); PrintDGMainInfo(ExponentialDG, "ExponentialDG"); PrintDGMainInfo(LogisticDG, "LogisticDG"); PrintDGMainInfo(CauchyDG, "CauchyDG"); PrintDGMainInfo(StudentsDG, "StudentsDG"); var MixedExponentialLogisticDG = new MixedExponentialLogisticDG(); var BoxMullerDG = new BoxMullerDG(); var TruncatedExponentialDG = new TruncatedExponentialDG(1.9, 2.1); BoxMullerDG.GenerateSequence(out double corr); Console.WriteLine("[==================[Additional tasks]==================]"); PrintDGMainInfo(MixedExponentialLogisticDG, "MixedExponentialLogisticDG"); PrintDGMainInfo(TruncatedExponentialDG, "TruncatedExponentialDistribution(a = 1.9, b = 2.1)"); Console.WriteLine($"[BoxMullerDistribution] \nEven/odd correlation: {Format(corr)}"); Console.Read(); }
private void StudentsDG_SelectedCellsChanged_1(object sender, SelectedCellsChangedEventArgs e) { if (e.AddedCells.Count == 0) { return; } var currentCell = e.AddedCells[0]; if (currentCell.Column == StudentsDG.Columns[1]) { StudentsDG.BeginEdit(); } }