private void btnPlot_Click(object sender, EventArgs e)
 {
     try
     {
         string input = tbInput.Text.Trim(' ');
         b.RootFunc = b.Insert(ref input);
         if (rbMainFunction.Checked)
         {
             pv1.Model.Series.Add(b.GetFunctionSerieMainFunction());
         }
         else if (rbDerAnalytically.Checked)
         {
             pv1.Model.Series.Add(b.GetFunctionSerieForDerivativeAnalytically());
         }
         else if (rbDerivativeNewton.Checked)
         {
             pv1.Model.Series.Add(b.GetFunctionSerieForDerivativeNewton());
         }
         else if (rbIntegral.Checked)
         {
             pv1.Model.Series.Add(b.GetFunctionSerieIntegral(Convert.ToDouble(tbLowerBound.Text), Convert.ToDouble(tbUpperBound.Text), ref result));
             MessageBox.Show(result.ToString());
         }
         else if (rbMcLaurinSerie.Checked)
         {
             for (int i = 1; i < 9; i++)
             {
                 pv1.Model.Series.Add(b.GetFunctionSeriesMcLaurinSeries(i));
             }
         }
     }
     catch (UnAcceptedDegreeForPowerException u)
     {
         MessageBox.Show(u.Message);
     }
     catch (UnacceptedFunctionForFactorialException u)
     {
         MessageBox.Show(u.Message);
     }
     catch (Denominator0Exception d)
     {
         MessageBox.Show(d.Message);
     }
     catch (IndexOutOfRangeException)
     {
         MessageBox.Show("Please input the correct format!");
     }
     catch (FormatException)
     {
         MessageBox.Show("Please input the correct format!");
     }
 }
 private void btnIntegral_Click(object sender, EventArgs e)
 {
     try
     {
         pv1.Model.InvalidatePlot(true);
         double result = 0, lowBound = Convert.ToDouble(tbLowerBound.Text), upperBound = Convert.ToDouble(tbUpperBound.Text);
         pv1.Model.Series.Add(b.GetFunctionSerieIntegral(lowBound, upperBound, ref result));
         tbInteValue.Text = result.ToString();
     }
     catch (FormatException)
     {
         MessageBox.Show("Please input the correct format!");
     }
     catch (UnAcceptedDegreeForPowerException u)
     {
         MessageBox.Show(u.Message);
     }
     catch (UnacceptedFunctionForFactorialException u)
     {
         MessageBox.Show(u.Message);
     }
 }