I want to define a vector partition function starting from a given list of vectors. For example, let's say I have vectors $v_1,v_2,v_1+v_2$ where $v_1,v_2$ are linearly independent and I want to list all the partitions using these three vectors. For convenience I can define the set of positive vectors to be the set ${kv_1+lv_2:k,l \in \mathbb{Z}_{\geq 0} } $, and for the program to be finite I am okay with taking $k,l only up to some fixed number, for example I have taken 2 below. I am trying as follows:
sage: v1,v2 = var('v1','v2')
sage: S = [v1,v2,v1+v2]
sage: Pos = [k*v1+l*v2 for k in [0,1,2] for l in [0,1,2]]
sage: def par(x):
sage: p(x) = []
sage: for y in S :
sage: if x-y in Pos:
sage: for z in p(x-y):
sage: n = z + y
sage: if n not in p(x):
sage: p(x)=p(x)+n
sage: return p(x)
This does not work. I don't understand why. Somehow sage: par(v1)
gives () as answer and sage: par(v1+v2)
gives TypeError: Must construct a function with a tuple (or list) of variables.
Please help me out.