Пример #1
0
        private void buttonCompareTwocurves_Click(object sender, EventArgs e)
        {
            int iNumOfSeries = 10000;
            List <List <Complex> > lstlstComplex1 = new List <List <Complex> >();
            List <List <Complex> > lstlstComplex2 = new List <List <Complex> >();
            {
                double dXValue = Convert.ToDouble(textBoxCompareX1.Text);
                double dYValue = Convert.ToDouble(textBoxCompareY1.Text);


                Complex start = new Complex(0, 0);
                for (int i = 1; i < iNumOfSeries; i++)
                {
                    List <Complex> lstComplexes      = getSeriesOneExponent(new Complex(dXValue, dYValue), i);
                    List <Complex> lstComplexesShift = addComplexToANumber(lstComplexes, start, i % 2 == 0);

                    List <Complex> lstLast = new List <Complex>();
                    lstLast.Add(start);
                    lstLast.Add(lstComplexesShift[lstComplexes.Count - 1]);
                    lstlstComplex1.Add(lstLast);

                    start = lstComplexesShift[lstComplexes.Count - 1];
                }
            }


            {
                double dXValue = Convert.ToDouble(textBoxCompareX2.Text);
                double dYValue = Convert.ToDouble(textBoxCompareY2.Text);


                Complex start = new Complex(0, 0);
                for (int i = 1; i < iNumOfSeries; i++)
                {
                    List <Complex> lstComplexes      = getSeriesOneExponent(new Complex(dXValue, dYValue), i);
                    List <Complex> lstComplexesShift = addComplexToANumber(lstComplexes, start, i % 2 == 0);

                    List <Complex> lstLast = new List <Complex>();
                    lstLast.Add(start);
                    lstLast.Add(lstComplexesShift[lstComplexes.Count - 1]);
                    lstlstComplex2.Add(lstLast);

                    start = lstComplexesShift[lstComplexes.Count - 1];
                }
            }


            FormCompare result = new FormCompare(lstlstComplex1, lstlstComplex2);

            result.StartPosition = FormStartPosition.Manual;
            result.Location      = new Point(0, 200);
            result.Show();
        }
Пример #2
0
        private void buttonMultiplyComplex_Click(object sender, EventArgs e)
        {
            double dXValue = -0.8;
            double dYValue = 5;



            List <List <Complex> > lstlstComplex1 = multplyAComplex(dXValue, dYValue, new Complex(1, 0));

            //double dRotate3 = Math.Log(Math.E, 3) * Math.PI * 2 - dYValue;
            //double dRotate4 = Math.Log(Math.E, 4) * Math.PI * 2 - dYValue;
            //double dRotate6 = Math.Log(Math.E, 6) * Math.PI * 2 - dYValue;
            //double dRotate8 = Math.Log(Math.E, 8) * Math.PI * 2 - dYValue;

            List <List <Complex> > lstlstComplex2 = multplyAComplex(dXValue, dYValue, new Complex(1, 0));

            FormCompare result = new FormCompare(lstlstComplex1, lstlstComplex2);

            result.StartPosition = FormStartPosition.Manual;
            result.Location      = new Point(0, 200);
            result.Show();

            int iLoopNum = 20;

            for (int i = 1; i <= iLoopNum; i++)
            {
                //double rotate2halfRound = Math.Log(Math.E, 2) * Math.PI * i;
                Complex cRotate = Complex.Exp(new Complex(0, Math.PI * i));

                Application.DoEvents();
                result.Show();
                Thread.Sleep(200);
                lstlstComplex2 = multplyAComplex(dXValue, dYValue, cRotate);

                result.setDataAndUpdate(lstlstComplex1, lstlstComplex2);

                //for (int j = 1; j < iLoopNum; j++)
                //{
                //    double rotate3halfRound = Math.Log(Math.E, 3) * Math.PI * j;

                //    for (int k = 1; k < iLoopNum; k++)
                //    {
                //        double rotate4halfRound = Math.Log(Math.E, 4) * Math.PI * k;
                //        //if (Math.Abs(rotate2halfRound - rotate3halfRound) < 0.01 && Math.Abs(rotate4halfRound - rotate3halfRound) < 0.01)
                //        //{

                //        }
                //    }
                //}
            }
        }