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 btnParse_Click(object sender, EventArgs e)
        {
            try
            {
                pv1.Model.InvalidatePlot(true);

                string input = tbInput.Text.Trim(' ');
                b.RootFunc    = b.Insert(ref input);
                tbResult.Text = b.ParseToString(b.RootFunc);
                pv1.Model.Series.Add(b.GetFunctionSerieMainFunction());
            }
            catch (UnAcceptedDegreeForPowerException u)
            {
                MessageBox.Show(u.Message);
            }
            catch (UnacceptedFunctionForFactorialException u)
            {
                MessageBox.Show(u.Message);
            }
            catch (FormatException)
            {
                MessageBox.Show("Please input the correct format!");
            }
        }