//Returns a generator that generates the nth derivative of elements generated by the source public static IGenerator <float> Differentiate(this IGenerator <float> generator, int n) { while (true) { if (n == 0) { return(generator.CloneAndRestart()); } if (n == 1) { return(generator.Differentiate()); } generator = generator.Differentiate(); n = n - 1; } }