differenceOrdinary function
============================== DIFFERENCING / INVERSION HELPERS
Nonseasonal differencing: apply d times
Implementation
/// Nonseasonal differencing: apply d times
List<double> differenceOrdinary(List<double> x, int d) {
if (d == 0) return List<double>.from(x);
var y = List<double>.from(x);
for (int k=0; k<d; k++) {
final ny = <double>[];
for (int i=1; i<y.length; i++) ny.add(y[i]-y[i-1]);
y = ny;
}
return y;
}