Beispiel #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            normal_generation E = new normal_generation();
            int    m            = 20000;
            double delta        = rboard / m;

            double[] yFCh = new double[m], x = new double[m], yFTh = new double[m];
            System.Windows.Forms.DataVisualization.Charting.Series s =
                new System.Windows.Forms.DataVisualization.Charting.Series();
            chart2.Series.Add(s);
            s.BorderWidth = 2;
            s.ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            System.Windows.Forms.DataVisualization.Charting.Series s2 =
                new System.Windows.Forms.DataVisualization.Charting.Series();
            chart2.Series.Add(s2);
            s2.BorderWidth = 2;
            s2.ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            num++;
            for (int i = 0; i < m; i++)
            {
                x[i]    = i * delta;
                yFCh[i] = get_F_ch(x[i]);
                yFTh[i] = 0.5 * (1 + E.Erf((x[i] - (N / lambda)) / Math.Sqrt(2 * N / (lambda * lambda))));
                chart2.Series[num - 1].Points.AddXY(x[i], yFCh[i]);
                chart2.Series[num].Points.AddXY(x[i], yFTh[i]);
            }
            chart2.Series[num - 1].Points.AddXY(rboard, 1);
            chart2.Series[num - 1].Points.AddXY(rboard + 1, 1);
            num++;
            dataGridView2.Rows[0].Cells[8].Value = Convert.ToString(get_max_dif(yFTh, yFCh, m));
        }
Beispiel #2
0
 private void set_qj(double[] ar, int K)
 {
     if (N == 1)
     {
         qj_array[0] = 1 - Math.Exp(-lambda * ar[0]);
         for (int i = 1; i < K - 1; ++i)
         {
             qj_array[i] = -Math.Exp(-lambda * ar[i]) + Math.Exp(-lambda * ar[i - 1]);
         }
         qj_array[K - 1] = Math.Exp(-lambda * ar[K - 2]);
     }
     else
     {
         normal_generation E = new normal_generation();
         qj_array[0] = 0.5 * (1 + E.Erf((ar[0] - (N / lambda)) / Math.Sqrt(2 * N / (lambda * lambda))));
         for (int i = 1; i < K - 1; ++i)
         {
             qj_array[i] = 0.5 * (1 + E.Erf((ar[i] - (N / lambda)) / Math.Sqrt(2 * N / (lambda * lambda)))) -
                           0.5 * (1 + E.Erf((ar[i - 1] - (N / lambda)) / Math.Sqrt(2 * N / (lambda * lambda))));
         }
         qj_array[K - 1] = 1 - 0.5 * (1 + E.Erf((ar[K - 2] - (N / lambda)) / Math.Sqrt(2 * N / (lambda * lambda))));
     }
 }