Permutation vectors with unknowns in Sage -
i'm trying work sage, , can't understand how following.
i've written little code:
def elementdr1(r): g = symmetricgroup(r) e = g.list() o = g.order() coeff = zerocoeff(o) in range(0,o): if e[i] == g("(1,r)"): coeff [i]=1 if e[i] == g("(2,3)*(1,r)"): coeff [i]=1 if e[i] == g("(1,3)*(1,r)"): coeff [i]=-1 return coeff
and sage says permutation vector (1,r)
invalid. i'm sure there must way write permutation vectors unknowns, can't find method looking @ sage help.
several issues here:
- the syntax creating element cycle decomposition
g("(1,2)(3,4)")
no * in between. - the cycles must disjoint, i.e., no element can appear twice. have 1 appearing twice.
- using r inside string instead of substituting: samuel lelièvre commented on already.
since (1,3)(1,r) not valid cycle decomposition, want multiply (1,3) (1,r). end, create these elements first , then multiply them (using * operator). since elements cycles, don't need string: element can created tuple.
def elementdr1(r): g = symmetricgroup(r) e = g.list() o = g.order() coeff = [0 in range(0,o)] # self-contained examples in range(0,o): if e[i] == g((1,r)): coeff[i] = 1 if e[i] == g((2,3))*g((1,r)): coeff[i] = 1 if e[i] == g((1,3))*g((1,r)): coeff[i] = -1 return coeff
now runs, outputting, example, [-1, 0, 0, 1, 0, 1]
r=3.
Comments
Post a Comment