Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt32(textBox1.Text);
            int k = Convert.ToInt32(textBox2.Text);

            if (radioButton1.Checked)
            {
                Task t  = new Task1(n, k * n);
                Task tt = new Task1(200, 600);

                t.addSplineDGV(dataGridView1);
                t.addResSplineDGV(dataGridView2);

                tt.addFSGraph(zedGraphControl1);
                t.addFpSpGraph(zedGraphControl2);
                t.addFppSppGraph(zedGraphControl3);

                t.addRGraph(zedGraphControl4);
                t.addRpGraph(zedGraphControl5);
                t.addRppGraph(zedGraphControl6);

                label2.Text  = Convert.ToString(n);
                label4.Text  = Convert.ToString(k * n);
                label6.Text  = Convert.ToString(t.maxr);
                label8.Text  = Convert.ToString(t.maxrx);
                label11.Text = Convert.ToString(t.maxrp);
                label15.Text = Convert.ToString(t.maxrpx);
                label12.Text = Convert.ToString(t.maxrpp);
                label16.Text = Convert.ToString(t.maxrppx);
            }

            if (radioButton2.Checked)
            {
                Task t  = new Task2(n, k * n, radioButton7.Checked);
                Task tt = new Task2(200, 600, radioButton7.Checked);

                t.addSplineDGV(dataGridView1);
                t.addResSplineDGV(dataGridView2);

                tt.addFSGraph(zedGraphControl1);
                t.addFpSpGraph(zedGraphControl2);
                t.addFppSppGraph(zedGraphControl3);

                t.addRGraph(zedGraphControl4);
                t.addRpGraph(zedGraphControl5);
                t.addRppGraph(zedGraphControl6);

                label2.Text  = Convert.ToString(n);
                label4.Text  = Convert.ToString(k * n);
                label6.Text  = Convert.ToString(t.maxr);
                label8.Text  = Convert.ToString(t.maxrx);
                label11.Text = Convert.ToString(t.maxrp);
                label15.Text = Convert.ToString(t.maxrpx);
                label12.Text = Convert.ToString(t.maxrpp);
                label16.Text = Convert.ToString(t.maxrppx);
            }

            if (radioButton3.Checked)
            {
                Task t  = new Task3(n, k * n, radioButton7.Checked);
                Task tt = new Task3(200, 600, radioButton7.Checked);

                t.addSplineDGV(dataGridView1);
                t.addResSplineDGV(dataGridView2);

                tt.addFSGraph(zedGraphControl1);
                t.addFpSpGraph(zedGraphControl2);
                t.addFppSppGraph(zedGraphControl3);

                t.addRGraph(zedGraphControl4);
                t.addRpGraph(zedGraphControl5);
                t.addRppGraph(zedGraphControl6);

                label2.Text  = Convert.ToString(n);
                label4.Text  = Convert.ToString(k * n);
                label6.Text  = Convert.ToString(t.maxr);
                label8.Text  = Convert.ToString(t.maxrx);
                label11.Text = Convert.ToString(t.maxrp);
                label15.Text = Convert.ToString(t.maxrpx);
                label12.Text = Convert.ToString(t.maxrpp);
                label16.Text = Convert.ToString(t.maxrppx);
            }

            if (radioButton4.Checked)
            {
                Task t  = new Task4(n, k * n, radioButton7.Checked);
                Task tt = new Task4(200, 600, radioButton7.Checked);

                t.addSplineDGV(dataGridView1);
                t.addResSplineDGV(dataGridView2);

                tt.addFSGraph(zedGraphControl1);
                t.addFpSpGraph(zedGraphControl2);
                t.addFppSppGraph(zedGraphControl3);

                t.addRGraph(zedGraphControl4);
                t.addRpGraph(zedGraphControl5);
                t.addRppGraph(zedGraphControl6);

                label2.Text  = Convert.ToString(n);
                label4.Text  = Convert.ToString(k * n);
                label6.Text  = Convert.ToString(t.maxr);
                label8.Text  = Convert.ToString(t.maxrx);
                label11.Text = Convert.ToString(t.maxrp);
                label15.Text = Convert.ToString(t.maxrpx);
                label12.Text = Convert.ToString(t.maxrpp);
                label16.Text = Convert.ToString(t.maxrppx);
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            int  N  = Convert.ToInt32(textBox6.Text);
            int  Nk = Convert.ToInt32(textBox5.Text);
            int  t  = 1;
            Task T;

            if (radioButton6.Checked == true)
            {
                if (radioButton4.Checked == true)
                {
                    t = 1;
                }
                if (radioButton3.Checked == true)
                {
                    t = 2;
                }
                T = new Task3(N, Nk, t);

                if (checkBox6.Checked == false)
                {
                    AddTable1(dataGridView5, N + 1, T);

                    AddTable2(dataGridView6, Nk + 1, T);
                }

                label19.Text = "maxR = " + Convert.ToString(T.maxR) + " при х = " + Convert.ToString(T.maxRx);
                label18.Text = "maxRp = " + Convert.ToString(T.maxRp) + " при х = " + Convert.ToString(T.maxRpx);
                label17.Text = "maxRpp = " + Convert.ToString(T.maxRpp) + " при х = " + Convert.ToString(T.maxRppx);

                if (checkBox5.Checked == false)
                {
                    AddGraph2(zedGraphControl11, Nk + 1, T.xk, T.f, T.S, "f(x)", "S(x)");

                    AddGraph1(zedGraphControl12, Nk + 1, T.xk, T.R, "R(x)");

                    AddGraph2(zedGraphControl13, Nk + 1, T.xk, T.fp, T.Sp, "f'(x)", "S'(x)");

                    AddGraph1(zedGraphControl14, Nk + 1, T.xk, T.Rp, "R'(x)");

                    AddGraph2(zedGraphControl15, Nk + 1, T.xk, T.fpp, T.Spp, "f''(x)", "S''(x)");
                }
            }

            if (radioButton5.Checked == true)
            {
                if (radioButton4.Checked == true)
                {
                    t = 1;
                }
                if (radioButton3.Checked == true)
                {
                    t = 2;
                }
                T = new Task4(N, Nk, t);

                if (checkBox6.Checked == false)
                {
                    AddTable1(dataGridView5, N + 1, T);

                    AddTable2(dataGridView6, Nk + 1, T);
                }

                label19.Text = "maxR = " + Convert.ToString(T.maxR) + " при х = " + Convert.ToString(T.maxRx);
                label18.Text = "maxRp = " + Convert.ToString(T.maxRp) + " при х = " + Convert.ToString(T.maxRpx);
                label17.Text = "maxRpp = " + Convert.ToString(T.maxRpp) + " при х = " + Convert.ToString(T.maxRppx);

                if (checkBox5.Checked == false)
                {
                    AddGraph2(zedGraphControl11, Nk + 1, T.xk, T.f, T.S, "f(x)", "S(x)");

                    AddGraph1(zedGraphControl12, Nk + 1, T.xk, T.R, "R(x)");

                    AddGraph2(zedGraphControl13, Nk + 1, T.xk, T.fp, T.Sp, "f'(x)", "S'(x)");

                    AddGraph1(zedGraphControl14, Nk + 1, T.xk, T.Rp, "R'(x)");

                    AddGraph2(zedGraphControl15, Nk + 1, T.xk, T.fpp, T.Spp, "f''(x)", "S''(x)");
                }
            }
        }