Пример #1
0
        private void button_count_Click(object sender, EventArgs e)
        {
            chart.Series[SeriesName].Points.Clear();
            chart.Series[transform].Points.Clear();
            Complex[] function;
            if (checkBox_useReal.Checked)
            {
                function = countRealFunction();
            }
            else
            {
                function = ComplexBuilder.buildRandom(ReadA(), ReadB(), ReadDim());
            }
            Complex[] transformRandom = TransformUtils.InverseTransform(function);
            double[]  top3;
            Complex[] compressed         = CompressUtils.ZeroByPercent(transformRandom, ReadPercent(), out top3);
            Complex[] compressedFunction = TransformUtils.ForvardTransform(compressed);
            setTop3(top3);
            Complex point;

            if (checkBox_useReal.Checked)
            {
                chart.Series[transform].ChartType = SeriesChartType.Line;
                double h = (ReadB() - ReadA()) / ReadDim();
                double x = ReadA();
                for (int i = 0; i < function.Length; i++)
                {
                    point = function[i];
                    chart.Series[SeriesName].Points.AddXY(x, point.Re);
                    chart.Series[transform].Points.AddXY(x, compressedFunction[i].Re);
                    x += h;
                }
            }
            else
            {
                for (int i = 0; i < function.Length; i++)
                {
                    point = function[i];
                    chart.Series[SeriesName].Points.AddXY(point.Re, point.Im);
                    chart.Series[transform].Points.AddXY(compressedFunction[i].Re, compressedFunction[i].Im);
                }
            }
        }