General function for making a feature array of arbitrary polynomial terms.