Here is a handy function that doesn't restrict itself to integers, but is very similar to the R base::seq function, which is seq(from, to, numberofPoints). In this case, this is used to create sequences from -x0 to x1 by 2*x0/(numberofPoints)
arma::vec seq_cpp(double a, double np){
double inc = (2*a)/np;
arma::vec s(np);
for(unsignedint i = 0; i < np; i++){
s(i) = -a + i*inc;
}
return s;
}