You can use the polynomialFeatures sklearn function. Here is an example:
Suppose this is your design matrix (i.e. function):
x = array([[ 3, 20, 11], [ 6, 2, 7], [18, 2, 17], [11, 12, 19], [ 7, 20, 6]]) x_t = PolynomialFeatures(2, interaction_only=True, include_bias=False).fit_transform(x)
Here is the result:
array([[ 3., 20., 11., 60., 33., 220.], [ 6., 2., 7., 12., 42., 14.], [ 18., 2., 17., 36., 306., 34.], [ 11., 12., 19., 132., 209., 228.], [ 7., 20., 6., 140., 42., 120.]])
The first 3 functions are the original functions, and the next three are the interactions of the original functions.