public static List <DataPoint> Create(MathActionInt function, int from, int to, int step) { var result = new List <DataPoint>(); var count = (to - from) / step; for (int r = from; r < to; r += step) { result.Add(new DataPoint() { XVals = r, YVals = function(r) }); } return(result); }
public static DataTable Create(MathActionInt function, int from, int to, int step) { var result = new DataTable(); result.Columns.Add(new DataColumn("XVals", typeof(int))); result.Columns.Add(new DataColumn("YVals", typeof(int))); var count = (to - from) / step; for (int r = from; r < to; r += step) { DataRow dr = result.NewRow(); dr[0] = r; dr[1] = function(r); result.Rows.Add(dr); } return(result); }