public static DataSeries <Value> Extrapolate(this DataSeries <Value> orig) { var slope = orig.Derivative(); return(orig.ZipElements <Value, Value>(slope, (o, s, v) => { if (o.Pos == 0) { return o[0].Val; } if (o.Pos == 1) { return o[1].Val; } return o[1] + s[1]; })); }