I would like you all to show me your results. After you have finished these programs please email them to me and I will post the shortest solution.

Solutions to the homework problems |

Exercise 1:

Given a value

(Hint: given a subset

Exercise 2:sage: def list_all_monomials( n, deg ):

....: return [subset_to_monomial( SS, deg ) for SS in Subsets(n+deg-1, n-1)]

Given an element of the dihedral group (generated by two elements $x$ and $y$ with $x^n = y^2 = 1$ and $x y = y x^{-1}$) and a polynomial in 2 variables ${\mathbb C}[ a_1, a_2 ]$, write a function which acts on the polynomial according to the action: $x(a_1) = \zeta a_1$, $y(a_1) = a_2$ where $\zeta$ is an $n^{th}$ root of unity. That is, write a function

There are several ways of working with a root of unity in sage. Two aresage: n = 4 # as an example take n=4

sage: (x,y) = DihedralGroup(n).gens() # this group is generated by two elements

sage: D4 = [ (a, b) for a in range(n) for b in range(2) ] # this is a list of exponents

sage: D4

[(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)]

sage: [ x^a*y^b for (a,b) in D4 ]

[(), (1,4)(2,3), (1,2,3,4), (1,3), (1,3)(2,4), (1,2)(3,4), (1,4,3,2), (2,4)]

sage: DihedralGroup(n).list() # not in the same order but the same elements

[(), (2,4), (1,2)(3,4), (1,2,3,4), (1,3), (1,3)(2,4), (1,4,3,2), (1,4)(2,3)]

The command

Exercise 3:

Write a function

Exercise 4:

Write a function which given a degree

Note: There may be a holdup here because in Exercise 3 it was ok to define your character function to work only with pairs

If you want to see how this works try the following commandsdef group_element_to_pair( g ):

"""

Converts a group element g of DihedralGroup(n) into a pair (a,b)

with a in range(n) and b in range(2)

EXAMPLES::

sage: [group_element_to_pair(g) for g in DihedralGroup(4)]

[(0, 0), (3, 1), (2, 1), (1, 0), (1, 1), (2, 0), (3, 0), (0, 1)]

"""

G = g.parent() # this is the dihedral group

(x,y) = G.gens() # these are the generators

# the following construction is a 'dictionary' which maps group elements

# to pairs over all possible group elements (not efficient, but it works)

M = { x^a*y^b : (a,b) for a in range(G.order()/2) for b in range(2) }

return M[g]

def pair_to_group_element(p, n):

"""

Converts a pair p = (a,b) into a group element of the DihedralGroup(n)

Given n, this function is the inverse of group_element_to_pair

EXAMPLES::

sage: all(pair_to_group_element(group_element_to_pair( g ), 4)==g for g in DihedralGroup(4))

True

sage: all(group_element_to_pair(pair_to_group_element((a,b),4))==(a,b) for a in range(4) for b in range(2))

True

"""

G = DihedralGroup(n)

(x,y) = G.gens()

return x^p[0]*y^p[1]

sage: pair_to_group_element((3,1), 5)

(1,2)(3,5)

sage: group_element_to_pair(_) # underline means the result of the last calculation

(3, 1)

sage: group_element_to_pair(DihedralGroup(5).list()[4])

(2, 1)

sage: [group_element_to_pair(g) for g in DihedralGroup(5)]

[(0, 0), (4, 1), (3, 1), (1, 0), (2, 1), (2, 0), (1, 1), (3, 0), (4, 0), (0, 1)]