/// <summary>
 /// A constructor gets a function and forms table about it
 /// </summary>
 /// <param name="xs">Arguments</param>
 /// <param name="func">The function it needs to create the table</param>
 public FunctionsTable(double[] xs, IFunction func)
 {
     X = xs;
     Y = new double[xs.Length];
     for (int i = 0; i < xs.Length; ++i)
     {
         Y[i] = func.Caclulate(xs[i]);
     }
 }
Beispiel #2
0
        //Draw function on chart
        private void DrawFunc(
            Chart chrt,
            IFunction func,
            double left,
            double right,
            string name = "")
        {
            if (chrt.Series.IndexOf(name) != -1)
            {
                chrt.Series.Remove(chrt.Series[name]);
            }
            var grp = new Series(name);

            grp.ChartType = SeriesChartType.Line;
            grp.ChartArea = "main";
            for (double x = left + eps; x <= right - eps; x += this.eps)
            {
                grp.Points.AddXY(x, func.Caclulate(x));
            }
            chrt.Series.Add(grp);
        }