I was interested in writing a program that given the number of variables and the degree of the multivariate polynomial, it was able to output the multivariate polynomial itself or evaluate it at a specific point (in reality I will feed it vectors with a value for each polynomial and I want to evaluate the polynomial). So here is an example input output in pseudocode:
f(variables=[x1,x2],Degree=D) = 1+x1+x2+x1x2+x1^2+x2^2
when there is a general number of variables and Degree it gets tricky.
I noticed that this problem is equivalent to considering tuples/sequences with that satisfy the following:
$$ S_D = \{ (d_0, ..., d_N) : \sum^N_{i=0} d_i = D \}$$
then my answer would be the set:
$$ S^{*}_D = \cup^D_{d'=0} S_{d'} = \{ (d_0, ..., d_N) : \sum^N_{i=0} d_i \leq D \} $$
I started with an example to try to actually compute that set, say degree 3 and 3 variables. I considered N = 3 and got the tuples:
- (3,0,0), (0,3,0), (0,0,3)
- (2,1,0), (2,0,1)
- (0,2,1), (1,2,0)
- (0,1,2), (1,0,2)
I also tried higher numbers but I didn't really see an obvious way to generalize it wrt to N or D. Any hints on how to do it? (Also the full solution is welcome so I can implement it for my real task)