rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
raise ValueError, "n must be greater than lbound: %s"%(lbound)
raise ValueError, "n must be at least lbound: %s"%(lbound)
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, the function uses a pseudo-primality test, which is much faster for really big numbers but does not provide a proof of primality. If None, uses the global default (see :mod:`sage.structure.proof.proof`) - ``lbound`` - an integer >= 2 lower bound for the chosen primes EXAMPLES:: sage: random_prime(100000) 88237 sage: random_prime(2) 2 Here we generate a random prime between 100 and 200:: sage: random_prime(200, lbound=100) 149 If all we care about is finding a pseudo prime, then we can pass in ``proof=False`` :: sage: random_prime(200, proof=False, lbound=100) 149 TESTS:: sage: type(random_prime(2)) <type 'sage.rings.integer.Integer'> sage: type(random_prime(100)) <type 'sage.rings.integer.Integer'> sage: random_prime(1, lbound=-2) #caused Sage hang #10112 Traceback (most recent call last): ... ValueError: n must be greater than or equal to 2 AUTHORS: - Jon Hanke (2006-08-08): with standard Stein cleanup - Jonathan Bober (2007-03-17) """ # since we don't want current_randstate to get # pulled when you say "from sage.arith import *". from sage.misc.randstate import current_randstate from sage.structure.proof.proof import get_flag proof = get_flag(proof, "arithmetic") n = ZZ(n) if n < 2: raise ValueError, "n must be greater than or equal to 2" if n < lbound: raise ValueError, "n must be greater than lbound: %s"%(lbound) elif n == 2: return ZZ(n) else: if not proof: prime_test = is_pseudoprime else: prime_test = is_prime randint = current_randstate().python_random().randint while(1): # In order to ensure that the returned prime is chosen # uniformly from the set of primes it is necessary to # choose a random number and then test for primality. # The method of choosing a random number and then returning # the closest prime smaller than it would typically not, # for example, return the first of a pair of twin primes. p = randint(lbound,n) if prime_test(p): return ZZ(p)
7be27a691399fe48873b13b15f955fa09aa9fb89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7be27a691399fe48873b13b15f955fa09aa9fb89/arith.py
return ZZ(n)
return n lbound = max(2, lbound) if lbound > 2: if lbound == 3 or n <= 2*lbound - 2: if lbound < 25 or n <= 6*lbound/5: if lbound < 2010760 or n <= 16598*lbound/16597: if proof: smallest_prime = ZZ(lbound-1).next_prime() else: smallest_prime = ZZ(lbound-1).next_probable_prime() if smallest_prime > n: raise ValueError, \ "There are no primes between %s and %s (inclusive)" % (lbound, n) if proof: prime_test = is_prime
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, the function uses a pseudo-primality test, which is much faster for really big numbers but does not provide a proof of primality. If None, uses the global default (see :mod:`sage.structure.proof.proof`) - ``lbound`` - an integer >= 2 lower bound for the chosen primes EXAMPLES:: sage: random_prime(100000) 88237 sage: random_prime(2) 2 Here we generate a random prime between 100 and 200:: sage: random_prime(200, lbound=100) 149 If all we care about is finding a pseudo prime, then we can pass in ``proof=False`` :: sage: random_prime(200, proof=False, lbound=100) 149 TESTS:: sage: type(random_prime(2)) <type 'sage.rings.integer.Integer'> sage: type(random_prime(100)) <type 'sage.rings.integer.Integer'> sage: random_prime(1, lbound=-2) #caused Sage hang #10112 Traceback (most recent call last): ... ValueError: n must be greater than or equal to 2 AUTHORS: - Jon Hanke (2006-08-08): with standard Stein cleanup - Jonathan Bober (2007-03-17) """ # since we don't want current_randstate to get # pulled when you say "from sage.arith import *". from sage.misc.randstate import current_randstate from sage.structure.proof.proof import get_flag proof = get_flag(proof, "arithmetic") n = ZZ(n) if n < 2: raise ValueError, "n must be greater than or equal to 2" if n < lbound: raise ValueError, "n must be greater than lbound: %s"%(lbound) elif n == 2: return ZZ(n) else: if not proof: prime_test = is_pseudoprime else: prime_test = is_prime randint = current_randstate().python_random().randint while(1): # In order to ensure that the returned prime is chosen # uniformly from the set of primes it is necessary to # choose a random number and then test for primality. # The method of choosing a random number and then returning # the closest prime smaller than it would typically not, # for example, return the first of a pair of twin primes. p = randint(lbound,n) if prime_test(p): return ZZ(p)
7be27a691399fe48873b13b15f955fa09aa9fb89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7be27a691399fe48873b13b15f955fa09aa9fb89/arith.py
if not proof: prime_test = is_pseudoprime else: prime_test = is_prime randint = current_randstate().python_random().randint while(1): p = randint(lbound,n) if prime_test(p): return ZZ(p)
prime_test = is_pseudoprime randint = current_randstate().python_random().randint while True: p = randint(lbound, n) if prime_test(p): return ZZ(p)
def random_prime(n, proof=None, lbound=2): """ Returns a random prime p between `lbound` and n (i.e. `lbound <= p <= n`). The returned prime is chosen uniformly at random from the set of prime numbers less than or equal to n. INPUT: - ``n`` - an integer >= 2. - ``proof`` - bool or None (default: None) If False, the function uses a pseudo-primality test, which is much faster for really big numbers but does not provide a proof of primality. If None, uses the global default (see :mod:`sage.structure.proof.proof`) - ``lbound`` - an integer >= 2 lower bound for the chosen primes EXAMPLES:: sage: random_prime(100000) 88237 sage: random_prime(2) 2 Here we generate a random prime between 100 and 200:: sage: random_prime(200, lbound=100) 149 If all we care about is finding a pseudo prime, then we can pass in ``proof=False`` :: sage: random_prime(200, proof=False, lbound=100) 149 TESTS:: sage: type(random_prime(2)) <type 'sage.rings.integer.Integer'> sage: type(random_prime(100)) <type 'sage.rings.integer.Integer'> sage: random_prime(1, lbound=-2) #caused Sage hang #10112 Traceback (most recent call last): ... ValueError: n must be greater than or equal to 2 AUTHORS: - Jon Hanke (2006-08-08): with standard Stein cleanup - Jonathan Bober (2007-03-17) """ # since we don't want current_randstate to get # pulled when you say "from sage.arith import *". from sage.misc.randstate import current_randstate from sage.structure.proof.proof import get_flag proof = get_flag(proof, "arithmetic") n = ZZ(n) if n < 2: raise ValueError, "n must be greater than or equal to 2" if n < lbound: raise ValueError, "n must be greater than lbound: %s"%(lbound) elif n == 2: return ZZ(n) else: if not proof: prime_test = is_pseudoprime else: prime_test = is_prime randint = current_randstate().python_random().randint while(1): # In order to ensure that the returned prime is chosen # uniformly from the set of primes it is necessary to # choose a random number and then test for primality. # The method of choosing a random number and then returning # the closest prime smaller than it would typically not, # for example, return the first of a pair of twin primes. p = randint(lbound,n) if prime_test(p): return ZZ(p)
7be27a691399fe48873b13b15f955fa09aa9fb89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7be27a691399fe48873b13b15f955fa09aa9fb89/arith.py
sage: cmp(N3, 3) -1
sage: abs( cmp(N3, 3) ) 1
def __cmp__(self, right): r""" Compare ``self`` and ``right``.
396b8ff061da0e49bb315b7342dcc37c63eb5cfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/396b8ff061da0e49bb315b7342dcc37c63eb5cfa/toric_lattice.py
def taylor(f, v, a, n):
def taylor(f, *args):
def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1 sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1 """ if not isinstance(f, Expression): f = SR(f) return f.taylor(v=v,a=a,n=n)
633bfa8986eb00c84d3329a7fc202dcbd0a6259c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/633bfa8986eb00c84d3329a7fc202dcbd0a6259c/functional.py
through `(x - a)^n`.
through `(x - a)^n`. Functions in more variables are also supported.
def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1 sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1 """ if not isinstance(f, Expression): f = SR(f) return f.taylor(v=v,a=a,n=n)
633bfa8986eb00c84d3329a7fc202dcbd0a6259c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/633bfa8986eb00c84d3329a7fc202dcbd0a6259c/functional.py
- ``v`` - variable - ``a`` - number - ``n`` - integer
- ``*args`` - the following notation is supported - ``x, a, n`` - variable, point, degree - ``(x, a), (y, b), ..., n`` - variables with points, degree of polynomial
def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1 sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1 """ if not isinstance(f, Expression): f = SR(f) return f.taylor(v=v,a=a,n=n)
633bfa8986eb00c84d3329a7fc202dcbd0a6259c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/633bfa8986eb00c84d3329a7fc202dcbd0a6259c/functional.py
return f.taylor(v=v,a=a,n=n)
return f.taylor(*args)
def taylor(f, v, a, n): """ Expands self in a truncated Taylor or Laurent series in the variable `v` around the point `a`, containing terms through `(x - a)^n`. INPUT: - ``v`` - variable - ``a`` - number - ``n`` - integer EXAMPLES:: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1 sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1 """ if not isinstance(f, Expression): f = SR(f) return f.taylor(v=v,a=a,n=n)
633bfa8986eb00c84d3329a7fc202dcbd0a6259c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/633bfa8986eb00c84d3329a7fc202dcbd0a6259c/functional.py
sage: import operator
def derivative(self, ex, operator): """ EXAMPLES::
a2648bce7d829c98198521873589084f0019ebd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a2648bce7d829c98198521873589084f0019ebd3/expression_conversions.py
sage: a = function('f', x).diff(x); a
sage: f = function('f') sage: a = f(x).diff(x); a
def derivative(self, ex, operator): """ EXAMPLES::
a2648bce7d829c98198521873589084f0019ebd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a2648bce7d829c98198521873589084f0019ebd3/expression_conversions.py
sage: b = function('f', x).diff(x).diff(x)
sage: b = f(x).diff(x, x)
def derivative(self, ex, operator): """ EXAMPLES::
a2648bce7d829c98198521873589084f0019ebd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a2648bce7d829c98198521873589084f0019ebd3/expression_conversions.py
args = ex.args()
args = ex.operands()
def derivative(self, ex, operator): """ EXAMPLES::
a2648bce7d829c98198521873589084f0019ebd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a2648bce7d829c98198521873589084f0019ebd3/expression_conversions.py
sage: P, = E.gens()
sage: P = E([0,-1])
sage: def naive_height(P):
1523650f8c44ebd1c01e5ada2c22749fbcc2122c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1523650f8c44ebd1c01e5ada2c22749fbcc2122c/ell_point.py
sage: def is_4regular(G): ... D = G.degree_sequence() ... return all(d == 4 for d in D) sage: is_4regular(G)
sage: G.is_regular(4)
sage: def is_4regular(G):
1f136b794113ab4131b630d092f3ffb71a488957 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1f136b794113ab4131b630d092f3ffb71a488957/graph_generators.py
sage: [ value, edges, [ setA, setB ]] = g.max_cut(vertices=True) sage: value == 5*6
sage: [ value, edges, [ setA, setB ]] = g.max_cut(vertices=True) sage: value == 5*6
def max_cut(self, value_only=True, use_edge_labels=True, vertices=False, solver=None, verbose=0): r""" Returns a maximum edge cut of the graph. For more information, see the `Wikipedia article on cuts <http://en.wikipedia.org/wiki/Cut_%28graph_theory%29>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: (bsetA == setA and bsetB == setB ) or ((bsetA == setB and bsetB == setA ))
sage: (bsetA == setA and bsetB == setB ) or ((bsetA == setB and bsetB == setA ))
def max_cut(self, value_only=True, use_edge_labels=True, vertices=False, solver=None, verbose=0): r""" Returns a maximum edge cut of the graph. For more information, see the `Wikipedia article on cuts <http://en.wikipedia.org/wiki/Cut_%28graph_theory%29>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.max_cut()
sage: g.max_cut()
def max_cut(self, value_only=True, use_edge_labels=True, vertices=False, solver=None, verbose=0): r""" Returns a maximum edge cut of the graph. For more information, see the `Wikipedia article on cuts <http://en.wikipedia.org/wiki/Cut_%28graph_theory%29>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.flow(1,2)
sage: g.flow(1,2)
def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, vertex_bound=False, solver=None, verbose=0): r""" Returns a maximum flow in the graph from ``x`` to ``y`` represented by an optimal valuation of the edges. For more information, see the `Wikipedia article on maximum flow <http://en.wikipedia.org/wiki/Max_flow>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: b.flow(('00',1),('00',2))
sage: b.flow(('00',1),('00',2))
def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, vertex_bound=False, solver=None, verbose=0): r""" Returns a maximum flow in the graph from ``x`` to ``y`` represented by an optimal valuation of the edges. For more information, see the `Wikipedia article on maximum flow <http://en.wikipedia.org/wiki/Max_flow>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.dominating_set(value_only=True)
sage: g.dominating_set(value_only=True)
def dominating_set(self, independent=False, value_only=False, solver=None, verbose=0): r""" Returns a minimum dominating set of the graph represented by the list of its vertices. For more information, see the `Wikipedia article on dominating sets <http://en.wikipedia.org/wiki/Dominating_set>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: len(g.dominating_set())
sage: len(g.dominating_set())
def dominating_set(self, independent=False, value_only=False, solver=None, verbose=0): r""" Returns a minimum dominating set of the graph represented by the list of its vertices. For more information, see the `Wikipedia article on dominating sets <http://en.wikipedia.org/wiki/Dominating_set>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: len(g.dominating_set(independent=True))
sage: len(g.dominating_set(independent=True))
def dominating_set(self, independent=False, value_only=False, solver=None, verbose=0): r""" Returns a minimum dominating set of the graph represented by the list of its vertices. For more information, see the `Wikipedia article on dominating sets <http://en.wikipedia.org/wiki/Dominating_set>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.edge_connectivity()
sage: g.edge_connectivity()
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: [ value, edges, [ setA, setB ]] = g.edge_connectivity(vertices=True) sage: print value
sage: [ value, edges, [ setA, setB ]] = g.edge_connectivity(vertices=True) sage: print value
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: len(setA) == 1 or len(setB) == 1
sage: len(setA) == 1 or len(setB) == 1
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: cut.add_edges(edges) sage: cut.is_isomorphic(graphs.StarGraph(4))
sage: cut.add_edges(edges) sage: cut.is_isomorphic(graphs.StarGraph(4))
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: min(g.degree()) >= g.edge_connectivity()
sage: min(g.degree()) >= g.edge_connectivity()
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: minimum = min([l for u,v,l in tree.edge_iterator()]) sage: [value, [(u,v,l)]] = tree.edge_connectivity(value_only=False, use_edge_labels=True) sage: l == minimum
sage: minimum = min([l for u,v,l in tree.edge_iterator()]) sage: [value, [(u,v,l)]] = tree.edge_connectivity(value_only=False, use_edge_labels=True) sage: l == minimum
def edge_connectivity(self, value_only=True, use_edge_labels=False, vertices=False, solver=None, verbose=0): r""" Returns the edge connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.vertex_connectivity()
sage: g.vertex_connectivity()
def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose=0): r""" Returns the vertex connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: [value, cut, [ setA, setB ]] = g.vertex_connectivity(sets=True) sage: len(setA) == 1 or len(setB) == 1
sage: [value, cut, [ setA, setB ]] = g.vertex_connectivity(sets=True) sage: len(setA) == 1 or len(setB) == 1
def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose=0): r""" Returns the vertex connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: [val, [cut_vertex]] = tree.vertex_connectivity(value_only=False) sage: tree.degree(cut_vertex) > 1
sage: [val, [cut_vertex]] = tree.vertex_connectivity(value_only=False) sage: tree.degree(cut_vertex) > 1
def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose=0): r""" Returns the vertex connectivity of the graph. For more information, see the `Wikipedia article on connectivity <http://en.wikipedia.org/wiki/Connectivity_(graph_theory)>`_.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.layout_graphviz()
sage: g.layout_graphviz()
def layout_graphviz(self, dim = 2, prog = 'dot', **options): """ Calls ``graphviz`` to compute a layout of the vertices of this graph.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.plot(layout = "graphviz")
sage: g.plot(layout = "graphviz")
def layout_graphviz(self, dim = 2, prog = 'dot', **options): """ Calls ``graphviz`` to compute a layout of the vertices of this graph.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.plot(layout = "graphviz", prog = "dot") sage: g.plot(layout = "graphviz", prog = "neato") sage: g.plot(layout = "graphviz", prog = "twopi") sage: g.plot(layout = "graphviz", prog = "fdp")
sage: g.plot(layout = "graphviz", prog = "dot") sage: g.plot(layout = "graphviz", prog = "neato") sage: g.plot(layout = "graphviz", prog = "twopi") sage: g.plot(layout = "graphviz", prog = "fdp")
def layout_graphviz(self, dim = 2, prog = 'dot', **options): """ Calls ``graphviz`` to compute a layout of the vertices of this graph.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
sage: g.plot(layout = "graphviz", prog = "circo")
sage: g.plot(layout = "graphviz", prog = "circo")
def layout_graphviz(self, dim = 2, prog = 'dot', **options): """ Calls ``graphviz`` to compute a layout of the vertices of this graph.
08b3ef8c500132f63d2dfd7371451a85a1a6987d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08b3ef8c500132f63d2dfd7371451a85a1a6987d/generic_graph.py
Please note that for more extensive use of R's plotting capabilities (such as the lattices package), it is advisable to either use an interactive plotting device or to use the notebook. The following examples are not tested, because they differ depending on operating system.
Please note that for more extensive use of R's plotting capabilities (such as the lattices package), it is advisable to either use an interactive plotting device or to use the notebook. The following examples are not tested, because they differ depending on operating system::
def plot(self, *args, **kwds): """ The R plot function. Type r.help('plot') for much more extensive documentation about this function. See also below for a brief introduction to more plotting with R.
2a794c3e48c54273fb8f797019c7148b5b2e9257 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/2a794c3e48c54273fb8f797019c7148b5b2e9257/r.py
In the notebook, one can use r.png() to open the device, but would need to use the following since R lattice graphics do not automatically print away from the command line.
In the notebook, one can use r.png() to open the device, but would need to use the following since R lattice graphics do not automatically print away from the command line::
def plot(self, *args, **kwds): """ The R plot function. Type r.help('plot') for much more extensive documentation about this function. See also below for a brief introduction to more plotting with R.
2a794c3e48c54273fb8f797019c7148b5b2e9257 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/2a794c3e48c54273fb8f797019c7148b5b2e9257/r.py
if self.ambient_vector_space() != other.ambient_vector_space(): return False if other == other.ambient_vector_space(): return True
try: if self.ambient_vector_space() != other.ambient_vector_space(): return False if other == other.ambient_vector_space(): return True except AttributeError: pass
def is_submodule(self, other): """ Return True if self is a submodule of other.
811da8d08981b12bc693926ac82e0321a72615db /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/811da8d08981b12bc693926ac82e0321a72615db/free_module.py
"""
r"""
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.
51ff5d9a7fa20a4153bbc1b635dc35c50c555d89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/51ff5d9a7fa20a4153bbc1b635dc35c50c555d89/graph_generators.py
Let q be an integer and let m_1,m_2,...m_k be a set of positive integers. Let n=q+m_1+...+m_k. The Fuzzy Ball graph with partition m_1,m_2,...,m_k and q extra vertices is the graph constructed from the graph G=K_n by attaching, for each i=1,2,...,k, a new vertex a_i to m_i distinct vertices of G. For given positive integers k and m and nonnegative integer q, the set of graphs FuzzyBallGraph(p, q) for all partitions `p=m_1+m_2+\cdots+m_k` of m are cospectral with respect to the
Let `q` be an integer and let `m_1,m_2,...,m_k` be a set of positive integers. Let `n=q+m_1+...+m_k`. The Fuzzy Ball graph with partition `m_1,m_2,...,m_k` and `q` extra vertices is the graph constructed from the graph `G=K_n` by attaching, for each `i=1,2,...,k`, a new vertex `a_i` to `m_i` distinct vertices of `G`. For given positive integers `k` and `m` and nonnegative integer `q`, the set of graphs ``FuzzyBallGraph(p, q)`` for all partitions `p=m_1+m_2+\cdots+m_k` of `m` are cospectral with respect to the
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.
51ff5d9a7fa20a4153bbc1b635dc35c50c555d89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/51ff5d9a7fa20a4153bbc1b635dc35c50c555d89/graph_generators.py
Pick positive integers m and k and a nonnegative integer q. All the FuzzyBallGraphs constructed from partitions of m with k parts should be cospectral with respect to the normalized
Pick positive integers `m` and `k` and a nonnegative integer `q`. All the FuzzyBallGraphs constructed from partitions of `m` with `k` parts should be cospectral with respect to the normalized
def FuzzyBallGraph(self, partition, q): """ Construct a Fuzzy Ball graph with the integer partition ``partition`` and ``q`` extra vertices.
51ff5d9a7fa20a4153bbc1b635dc35c50c555d89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/51ff5d9a7fa20a4153bbc1b635dc35c50c555d89/graph_generators.py
"""
r"""
def eigenvalues(self,extend=True): """ Returns a list with the eigenvalues of the endomorphism of vector spaces.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
If the option extend is set to True (default), then eigenvalues in extensions of the base field are considered.
INPUT: - ``extend`` -- boolean (default: True) decides if base field extensions should be considered or not.
def eigenvalues(self,extend=True): """ Returns a list with the eigenvalues of the endomorphism of vector spaces.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
We compute the eigenvalues of an endomorphism of QQ^3::
We compute the eigenvalues of an endomorphism of `\QQ^3`::
def eigenvalues(self,extend=True): """ Returns a list with the eigenvalues of the endomorphism of vector spaces.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
Note the effect of the extend option::
Note the effect of the ``extend`` option::
def eigenvalues(self,extend=True): """ Returns a list with the eigenvalues of the endomorphism of vector spaces.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
def eigenvalues(self,extend=True): """ Returns a list with the eigenvalues of the endomorphism of vector spaces.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
- extend (True) decides if base field extensions should be considered or not.
- ``extend`` -- boolean (default: True) decides if base field extensions should be considered or not.
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
A sequence of tuples. Each tuple contains an eigenvalue, a list with a basis of the corresponding subspace of eigenvectors, and the algebraic multiplicity of the eigenvalue.
A sequence of tuples. Each tuple contains an eigenvalue, a sequence with a basis of the corresponding subspace of eigenvectors, and the algebraic multiplicity of the eigenvalue.
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
[(3, [(0, 0, 1, -6/7)], 1), (-1*I, [(1, 1*I, 0, -0.571428571428572? + 2.428571428571429?*I)], 1), (1*I, [(1, -1*I, 0, -0.571428571428572? - 2.428571428571429?*I)], 1)]
[(3, [ (0, 0, 1, -6/7) ], 1), (-1*I, [ (1, 1*I, 0, -0.571428571428572? + 2.428571428571429?*I) ], 1), (1*I, [ (1, -1*I, 0, -0.571428571428572? - 2.428571428571429?*I) ], 1)]
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
[(3, [(0, 0, 1, -6/7)], 1)]
[(3, [ (0, 0, 1, -6/7) ], 1)]
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
[(3, [(0, 0, 1, -6/7)], 1), (2, [(0, 1, 0, 17/7)], 2)]
[(3, [ (0, 0, 1, -6/7) ], 1), (2, [ (0, 1, 0, 17/7) ], 2)]
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
[(3, [(0, 0, 1, -6/7)], 1), (2, [(0, 1, 0, 17/7)], 2)]
[(3, [ (0, 0, 1, -6/7) ], 1), (2, [ (0, 1, 0, 17/7) ], 2)]
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
svectors=map(lambda j: V(j * V.basis_matrix()),i[1]) resu.append(tuple([i[0],svectors,i[2]]))
svectors=Sequence(map(lambda j: V(j * V.basis_matrix()),i[1]), cr=True) resu.append((i[0],svectors,i[2]))
def eigenvectors(self,extend=True): """ Computes the subspace of eigenvectors of a given eigenvalue.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
- ``var`` - string (default: 'x') a variable
- ``var`` - string (default: 'x') a variable name
def minpoly(self,var='x'): """ Computes the minimal polynomial.
008040e2ed037beda080180d1d6162300fff207d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/008040e2ed037beda080180d1d6162300fff207d/free_module_morphism.py
sgi = set(range(fan.nrays()))
sgi = set(range(fan.ngenerating_cones()))
def star_generator_indices(self): r""" Return indices of generating cones of the "ambient fan" containing ``self``.
7c2371cbb7e6b1f6dfe45fdeadaca434539ab071 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7c2371cbb7e6b1f6dfe45fdeadaca434539ab071/fan.py
SL(n); you also some information about representations of E6
SL(n); you also lose some information about representations of E6
def WeylCharacterRing(ct, base_ring=ZZ, prefix=None, cache=False, style="lattice"): r""" A class for rings of Weyl characters. The Weyl character is a character of a semisimple (or reductive) Lie group or algebra. They form a ring, in which the addition and multiplication correspond to direct sum and tensor product of representations. INPUT: - ``ct`` -- The Cartan Type OPTIONAL ARGUMENTS: - ``base_ring`` -- (default: `\ZZ`) - ``prefix`` -- (default: an automatically generated prefix based on Cartan type) - ``cache`` -- (default False) setting cache = True is a substantial speedup at the expense of some memory. - ``style`` -- (default "lattice") can be set style = "coroots" to obtain an alternative representation of the elements. If no prefix specified, one is generated based on the Cartan type. It is good to name the ring after the prefix, since then it can parse its own output. EXAMPLES:: sage: G2 = WeylCharacterRing(['G',2]) sage: [fw1,fw2] = G2.fundamental_weights() sage: 2*G2(2*fw1+fw2) 2*G2(4,-1,-3) sage: 2*G2(4,-1,-3) 2*G2(4,-1,-3) sage: G2(4,-1,-3).degree() 189 Note that since the ring was named `G_2` after its default prefix, it was able to parse its own output. You do not have to use the default prefix. Thus: EXAMPLES:: sage: R = WeylCharacterRing(['B',3], prefix='R') sage: chi = R(R.fundamental_weights()[3]); chi R(1/2,1/2,1/2) sage: R(1/2,1/2,1/2) == chi True You may choose an alternative style of labeling the elements. If you create the ring with the option style="coroots" then the integers in the label are not the components of the highest weight vector, but rather the coefficients when the highest weight vector is decomposed into a product of irreducibles. These coefficients are the values of the coroots on the highest weight vector. In the coroot style the Lie group or Lie algebra is treated as semisimple, so you lose the distinction between GL(n) and SL(n); you also some information about representations of E6 and E7 for the same reason. The coroot style gives you output that is comparable to that in Tables of Dimensions, Indices and Branching Rules for Representations of Simple Lie Algebras (Marcel Dekker, 1981). EXAMPLES:: sage: B3 = WeylCharacterRing("B3",style="coroots") sage: [fw1,fw2,fw3]=B3.fundamental_weights() sage: fw1+fw3 (3/2, 1/2, 1/2) sage: B3(fw1+fw3) B3(1,0,1) sage: B3(1,0,1) B3(1,0,1) For type ['A',r], the coroot representation carries less information, since elements of the weight lattice that are orthogonal to the coroots are represented as zero. This means that with the default style you can represent the determinant, but not in the coroot style. In the coroot style, elements of the Weyl character ring represent characters of SL(r+1,CC), while in the default style, they represent characters of GL(r+1,CC). EXAMPLES:: sage: A2 = WeylCharacterRing("A2") sage: L = A2.space() sage: [A2(L.det()), A2(L(0))] [A2(1,1,1), A2(0,0,0)] sage: A2(L.det()) == A2(L(0)) False sage: A2 = WeylCharacterRing("A2", style="coroots") sage: [A2(L.det()), A2(L(0))] [A2(0,0), A2(0,0)] sage: A2(L.det()) == A2(L(0)) True The multiplication in a Weyl character ring corresponds to the product of characters, which you can use to determine the decomposition of tensor products into irreducibles. For example, let us compute the tensor product of the standard and spin representations of Spin(7). EXAMPLES:: sage: B3 = WeylCharacterRing("B3") sage: [fw1,fw2,fw3]=B3.fundamental_weights() sage: [B3(fw1).degree(),B3(fw3).degree()] [7, 8] sage: B3(fw1)*B3(fw3) B3(1/2,1/2,1/2) + B3(3/2,1/2,1/2) The name of the irreducible representation encodes the highest weight vector. TESTS:: sage: F4 = WeylCharacterRing(['F',4], cache = True) sage: [fw1,fw2,fw3,fw4] = F4.fundamental_weights() sage: chi = F4(fw4); chi, chi.degree() (F4(1,0,0,0), 26) sage: chi^2 F4(0,0,0,0) + F4(1,0,0,0) + F4(1,1,0,0) + F4(3/2,1/2,1/2,1/2) + F4(2,0,0,0) sage: [x.degree() for x in [F4(0,0,0,0), F4(1,0,0,0), F4(1,1,0,0), F4(3/2,1/2,1/2,1/2), F4(2,0,0,0)]] [1, 26, 52, 273, 324] You can produce a list of the irreducible elements of an irreducible character. EXAMPLES:: sage: R = WeylCharacterRing(['A',2], prefix = R) sage: sorted(R([2,1,0]).mlist()) [[(1, 1, 1), 2], [(1, 2, 0), 1], [(1, 0, 2), 1], [(2, 1, 0), 1], [(2, 0, 1), 1], [(0, 1, 2), 1], [(0, 2, 1), 1]] """ ct = cartan_type.CartanType(ct) return cache_wcr(ct, base_ring=base_ring, prefix=prefix, cache=cache, style=style)
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
"automorphic", "symmetric", "extended", "triality" or "miscellaneous". The use of these rules will be explained next. After the examples we will explain how to write your own branching rules for cases that we have omitted.
"automorphic", "symmetric", "extended", "orthogonal_sum", "tensor", "triality" or "miscellaneous". The use of these rules will be explained next. After the examples we will explain how to write your own branching rules for cases that we have omitted.
def branch_weyl_character(chi, R, S, rule="default"): r""" A Branching rule describes the restriction of representations from a Lie group or algebra G to a smaller one. See for example, R. C. King, Branching rules for classical Lie groups using tensor and spinor methods. J. Phys. A 8 (1975), 429-449, Howe, Tan and Willenbring, Stable branching rules for classical symmetric pairs, Trans. Amer. Math. Soc. 357 (2005), no. 4, 1601-1626, McKay and Patera, Tables of Dimensions, Indices and Branching Rules for Representations of Simple Lie Algebras (Marcel Dekker, 1981), and Fauser, Jarvis, King and Wybourne, New branching rules induced by plethysm. J. Phys. A 39 (2006), no. 11, 2611--2655. INPUT: - ``chi`` - a character of G - ``R`` - the Weyl Character Ring of G - ``S`` - the Weyl Character Ring of H - ``rule`` - a set of r dominant weights in H where r is the rank of G. You may use a predefined rule by specifying rule = one of"levi", "automorphic", "symmetric", "extended", "triality" or "miscellaneous". The use of these rules will be explained next. After the examples we will explain how to write your own branching rules for cases that we have omitted. To explain the predefined rules we survey the most important branching rules. These may be classified into several cases, and once this is understood, the detailed classification can be read off from the Dynkin diagrams. Dynkin classified the maximal subgroups of Lie groups in Mat. Sbornik N.S. 30(72):349-462 (1952). We will list give predefined rules that cover most cases where the branching rule is to a maximal subgroup. For convenience, we also give some branching rules to subgroups that are not maximal. For example, a Levi subgroup may or may not be maximal. LEVI TYPE. These can be read off from the Dynkin diagram. If removing a node from the Dynkin diagram produces another Dynkin diagram, there is a branching rule. Currently we require that the smaller diagram be connected. For these rules use the option rule="levi":: ['A',r] => ['A',r-1] ['B',r] => ['A',r-1] ['B',r] => ['B',r-1] ['C',r] => ['A',r-1] ['C',r] => ['C',r-1] ['D',r] => ['A',r-1] ['D',r] => ['D',r-1] ['E',r] => ['A',r-1] r = 7,8 ['E',r] => ['D',r-1] r = 6,7,8 ['E',r] => ['E',r-1] F4 => B3 F4 => C3 G2 => A1 (short root) Not all Levi subgroups are maximal subgroups. If the Levi is not maximal there may or may not be a preprogrammed rule="levi" for it. If there is not, the branching rule may still be obtained by going through an intermediate subgroup that is maximal using rule="extended". Thus the other Levi branching rule from G2 => A1 corresponding to the long root is available by first branching G2 => A_2 then A2 => A1. Similarly the branching rules to the Levi subgroup:: ['E',r] => ['A',r-1] r = 6,7,8 may be obtained by first branching E6=>A5xA1, E7=>A7 or E8=>A8. AUTOMORPHIC TYPE. If the Dynkin diagram has a symmetry, then there is an automorphism that is a special case of a branching rule. There is also an exotic "triality" automorphism of D4 having order 3. Use rule="automorphic" or (for D4) rule="triality":: ['A',r] => ['A',r] ['D',r] => ['D',r] E6 => E6 SYMMETRIC TYPE. Related to the automorphic type, when either the Dynkin diagram or the extended diagram has a symmetry there is a branching rule to the subalgebra (or subgroup) of invariants under the automorphism. Use rule="symmetric". The last branching rule, D4=>G2 is not to a maximal subgroup since D4=>B3=>G2, but it is included for convenience. :: ['A',2r+1] => ['B',r] ['A',2r] => ['C',r] ['A',2r] => ['D',r] ['D',r] => ['B',r-1] E6 => F4 D4 => G2 EXTENDED TYPE. If removing a node from the extended Dynkin diagram results in a Dynkin diagram, then there is a branching rule. Use rule="extended" for these. We will also use this classification for some rules that are not of this type, mainly involving type B, such as D6 => B3xB3. Here is the extended Dynkin diagram for D6:: 0 6 O O | | | | O---O---O---O---O 1 2 3 4 6 Removing the node 3 results in an embedding D3xD3 -> D6. This corresponds to the embedding SO(6)xSO(6) -> SO(12), and is of extended type. On the other hand the embedding SO(5)xSO(7)-->SO(12) (e.g. B2xB3 -> D6) cannot be explained this way but for uniformity is implemented under rule="extended". Using rule="extended" you can get any branching rule SO(n) => SO(a) x SO(b) x SO(c) x ... where n = a+b+c+ ... Sp(2n) => Sp(2a) x Sp(2b) x Sp(2c) x ... where n = a+b+c+ ... where O(a) = ['D',r] (a=2r) or ['B',r] (a=2r+1) and Sp(2r)=['C',r]. The following rules are implemented as special cases of rule="extended". :: E6 => A5xA1, A2xA2xA2 E7 => A7, D6xA1, A3xA3xA1 E8 => A8, D8, E7xA1, A4xA4, D5xA3, E6xA2 F4 => B4, C3xA1, A2xA2, A3xA1 G2 => A1xA1 Note that E8 has only a limited number of representations of reasonably low degree. TENSOR: There are branching rules: :: ['A', rs-1] => ['A',r-1] x ['A',s-1] ['B',2rs+r+s] => ['B',r] x ['B',s] ['D',2rs+s] => ['B',r] x ['D',s] ['D',2rs] => ['D',r] x ['D',s] ['D',2rs] => ['C',r] x ['C',s] ['C',2rs+s] => ['B',r] x ['C',s] ['C',2rs] => ['C',r] x ['D',s]. corresponding to the tensor product homomorphism. For type A, the homomorphism is GL(r) x GL(s) -> GL(rs). For the classical types, the relevant fact is that if V,W are orthogonal or symplectic spaces, that is, spaces endowed with symmetric or skew-symmetric bilinear forms, then V tensor W is also an orthogonal space (if V and W are both orthogonal or both symplectic) or symplectic (if one of V and W is orthogonal and the other symplectic). The corresponding branching rules are obtained using rule="tensor". SYMMETRIC POWER: The k-th symmetric and exterior power homomorphisms map GL(n) --> GL(binomial(n+k-1,k)) and GL(binomial(n,k)). The corresponding branching rules are not implemented but a special case is. The k-th symmetric power homomorphism SL(2) --> GL(k+1) has its image inside of SO(2r+1) if k=2r and inside of Sp(2r) if k=2r-1. Hence there are branching rules:: ['B',r] => A1 ['C',r] => A1 and these may be obtained using the rule "symmetric_power". MISCELLANEOUS: Use rule="miscellaneous" for the following rules:: B3 => G2 F4 => G2xA1 (not implemented yet) BRANCHING RULES FROM PLETHYSMS Nearly all branching rules G => H where G is of type A,B,C or D are covered by the preceding rules. The function branching_rules_from_plethysm covers the remaining cases. ISOMORPHIC TYPE: Although not usually referred to as a branching rule, the effects of the accidental isomorphisms may be handled using rule="isomorphic":: B2 => C2 C2 => B2 A3 => D3 D3 => A3 D2 => A1xA1 B1 => A1 C1 => A1 EXAMPLES: (Levi type) :: sage: A1 = WeylCharacterRing("A1") sage: A2 = WeylCharacterRing("A2") sage: A3 = WeylCharacterRing("A3") sage: A4 = WeylCharacterRing("A4") sage: A5 = WeylCharacterRing("A5") sage: B2 = WeylCharacterRing("B2") sage: B3 = WeylCharacterRing("B3") sage: B4 = WeylCharacterRing("B4") sage: C2 = WeylCharacterRing("C2") sage: C3 = WeylCharacterRing("C3") sage: D3 = WeylCharacterRing("D3") sage: D4 = WeylCharacterRing("D4") sage: D5 = WeylCharacterRing("D5") sage: G2 = WeylCharacterRing("G2") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: [B3(w).branch(A2,rule="levi") for w in B3.fundamental_weights()] [A2(0,0,-1) + A2(0,0,0) + A2(1,0,0), A2(0,-1,-1) + A2(0,0,-1) + A2(0,0,0) + A2(1,0,-1) + A2(1,0,0) + A2(1,1,0), A2(-1/2,-1/2,-1/2) + A2(1/2,-1/2,-1/2) + A2(1/2,1/2,-1/2) + A2(1/2,1/2,1/2)] The last example must be understood as follows. The representation of B3 being branched is spin, which is not a representation of SO(7) but of its double cover spin(7). The group A2 is really GL(3) and the double cover of SO(7) induces a cover of GL(3) that is trivial over SL(3) but not over the center of GL(3). The weight lattice for this GL(3) consists of triples (a,b,c) of half integers such that a-b and b-c are in `\ZZ`, and this is reflected in the last decomposition. :: sage: [C3(w).branch(A2,rule="levi") for w in C3.fundamental_weights()] [A2(0,0,-1) + A2(1,0,0), A2(0,-1,-1) + A2(1,0,-1) + A2(1,1,0), A2(-1,-1,-1) + A2(1,-1,-1) + A2(1,1,-1) + A2(1,1,1)] sage: [D4(w).branch(A3,rule="levi") for w in D4.fundamental_weights()] [A3(0,0,0,-1) + A3(1,0,0,0), A3(0,0,-1,-1) + A3(0,0,0,0) + A3(1,0,0,-1) + A3(1,1,0,0), A3(1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,-1/2), A3(-1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,1/2)] sage: [B3(w).branch(B2,rule="levi") for w in B3.fundamental_weights()] [2*B2(0,0) + B2(1,0), B2(0,0) + 2*B2(1,0) + B2(1,1), 2*B2(1/2,1/2)] sage: C3 = WeylCharacterRing(['C',3]) sage: [C3(w).branch(C2,rule="levi") for w in C3.fundamental_weights()] [2*C2(0,0) + C2(1,0), C2(0,0) + 2*C2(1,0) + C2(1,1), C2(1,0) + 2*C2(1,1)] sage: [D5(w).branch(D4,rule="levi") for w in D5.fundamental_weights()] [2*D4(0,0,0,0) + D4(1,0,0,0), D4(0,0,0,0) + 2*D4(1,0,0,0) + D4(1,1,0,0), D4(1,0,0,0) + 2*D4(1,1,0,0) + D4(1,1,1,0), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2)] sage: G2(1,0,-1).branch(A1,rule="levi") A1(0,-1) + A1(1,-1) + A1(1,0) sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: fw = E6.fundamental_weights() sage: [E6(fw[i]).branch(D5,rule="levi") for i in [1,2,6]] # long time (3s) [D5(0,0,0,0,0) + D5(0,0,0,0,1) + D5(1,0,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(0,0,0,0,1) + D5(0,1,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(1,0,0,0,0)] sage: E7=WeylCharacterRing("E7",style="coroots") sage: D6=WeylCharacterRing("D6",style="coroots") sage: fw = E7.fundamental_weights() sage: [E7(fw[i]).branch(D6,rule="levi") for i in [1,2,7]] # long time (26s) [3*D6(0,0,0,0,0,0) + 2*D6(0,0,0,0,1,0) + D6(0,1,0,0,0,0), 3*D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0) + 2*D6(0,0,1,0,0,0) + D6(1,0,0,0,1,0), D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0)] sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8=WeylCharacterRing("E8",style="coroots",cache=True) sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8(1,0,0,0,0,0,0,0).branch(D7,rule="levi") # not tested (very long time) (160s) 3*D7(0,0,0,0,0,0,0) + 2*D7(0,0,0,0,0,1,0) + 2*D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) + 2*D7(0,0,1,0,0,0,0) + D7(0,0,0,1,0,0,0) + D7(1,0,0,0,0,1,0) + D7(1,0,0,0,0,0,1) + D7(2,0,0,0,0,0,0) sage: E8(0,0,0,0,0,0,0,1).branch(D7,rule="levi") # long time (3s) D7(0,0,0,0,0,0,0) + D7(0,0,0,0,0,1,0) + D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) sage: [F4(fw).branch(B3,rule="levi") for fw in F4.fundamental_weights()] # long time (36s) [B3(0,0,0) + 2*B3(1/2,1/2,1/2) + 2*B3(1,0,0) + B3(1,1,0), B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 5*B3(1,0,0) + 7*B3(1,1,0) + 3*B3(1,1,1) + 6*B3(3/2,1/2,1/2) + 2*B3(3/2,3/2,1/2) + B3(2,0,0) + 2*B3(2,1,0) + B3(2,1,1), 3*B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 4*B3(1,0,0) + 3*B3(1,1,0) + B3(1,1,1) + 2*B3(3/2,1/2,1/2), 3*B3(0,0,0) + 2*B3(1/2,1/2,1/2) + B3(1,0,0)] sage: [F4(fw).branch(C3,rule="levi") for fw in F4.fundamental_weights()] # long time (6s) [3*C3(0,0,0) + 2*C3(1,1,1) + C3(2,0,0), 3*C3(0,0,0) + 6*C3(1,1,1) + 4*C3(2,0,0) + 2*C3(2,1,0) + 3*C3(2,2,0) + C3(2,2,2) + C3(3,1,0) + 2*C3(3,1,1), 2*C3(1,0,0) + 3*C3(1,1,0) + C3(2,0,0) + 2*C3(2,1,0) + C3(2,1,1), 2*C3(1,0,0) + C3(1,1,0)] sage: A1xA1 = WeylCharacterRing("A1xA1") sage: [A3(hwv).branch(A1xA1,rule="levi") for hwv in A3.fundamental_weights()] [A1xA1(0,0,1,0) + A1xA1(1,0,0,0), A1xA1(0,0,1,1) + A1xA1(1,0,1,0) + A1xA1(1,1,0,0), A1xA1(1,0,1,1) + A1xA1(1,1,1,0)] sage: A1xB1=WeylCharacterRing("A1xB1",style="coroots") sage: [B3(x).branch(A1xB1,rule="levi") for x in B3.fundamental_weights()] [A1xB1(0,2) + 2*A1xB1(1,0), 3*A1xB1(0,0) + A1xB1(0,2) + 2*A1xB1(1,2) + A1xB1(2,0), 2*A1xB1(0,1) + A1xB1(1,1)] EXAMPLES: (Automorphic type, including D4 triality) :: sage: [A3(chi).branch(A3,rule="automorphic") for chi in A3.fundamental_weights()] [A3(0,0,0,-1), A3(0,0,-1,-1), A3(0,-1,-1,-1)] sage: [D4(chi).branch(D4,rule="automorphic") for chi in D4.fundamental_weights()] [D4(1,0,0,0), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2)] sage: [D4(chi).branch(D4,rule="triality") for chi in D4.fundamental_weights()] [D4(1/2,1/2,1/2,-1/2), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1,0,0,0)] EXAMPLES: (Symmetric type) :: sage: [w.branch(B2,rule="symmetric") for w in [A4(1,0,0,0,0),A4(1,1,0,0,0),A4(1,1,1,0,0),A4(2,0,0,0,0)]] [B2(1,0), B2(1,1), B2(1,1), B2(0,0) + B2(2,0)] sage: [A5(w).branch(C3,rule="symmetric") for w in A5.fundamental_weights()] [C3(1,0,0), C3(0,0,0) + C3(1,1,0), C3(1,0,0) + C3(1,1,1), C3(0,0,0) + C3(1,1,0), C3(1,0,0)] sage: [A5(w).branch(D3,rule="symmetric") for w in A5.fundamental_weights()] [D3(1,0,0), D3(1,1,0), D3(1,1,-1) + D3(1,1,1), D3(1,1,0), D3(1,0,0)] sage: [D4(x).branch(B3,rule="symmetric") for x in D4.fundamental_weights()] [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(1,1,0), B3(1/2,1/2,1/2), B3(1/2,1/2,1/2)] sage: [D4(x).branch(G2,rule="symmetric") for x in D4.fundamental_weights()] [G2(0,0,0) + G2(1,0,-1), 2*G2(1,0,-1) + G2(2,-1,-1), G2(0,0,0) + G2(1,0,-1), G2(0,0,0) + G2(1,0,-1)] sage: [E6(fw).branch(F4,rule="symmetric") for fw in E6.fundamental_weights()] # long time (36s) [F4(0,0,0,0) + F4(0,0,0,1), F4(0,0,0,1) + F4(1,0,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(1,0,0,0) + 2*F4(0,0,1,0) + F4(1,0,0,1) + F4(0,1,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(0,0,0,0) + F4(0,0,0,1)] EXAMPLES: (Extended type) :: sage: [B3(x).branch(D3,rule="extended") for x in B3.fundamental_weights()] [D3(0,0,0) + D3(1,0,0), D3(1,0,0) + D3(1,1,0), D3(1/2,1/2,-1/2) + D3(1/2,1/2,1/2)] sage: [G2(w).branch(A2, rule="extended") for w in G2.fundamental_weights()] [A2(0,0,0) + A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3), A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3) + A2(1,0,-1)] sage: [F4(fw).branch(B4,rule="extended") for fw in F4.fundamental_weights()] # long time (9s) [B4(1/2,1/2,1/2,1/2) + B4(1,1,0,0), B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2) + B4(3/2,3/2,1/2,1/2) + B4(2,1,1,0), B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0) + B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2), B4(0,0,0,0) + B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0)] sage: E6 = WeylCharacterRing("E6", style="coroots") sage: A2xA2xA2=WeylCharacterRing("A2xA2xA2",style="coroots") sage: A5xA1=WeylCharacterRing("A5xA1",style="coroots") sage: G2 = WeylCharacterRing("G2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: A3xA1 = WeylCharacterRing("A3xA1", style="coroots") sage: A2xA2 = WeylCharacterRing("A2xA2", style="coroots") sage: A1xC3 = WeylCharacterRing("A1xC3",style="coroots") sage: E6(1,0,0,0,0,0).branch(A5xA1,rule="extended") # (0.7s) A5xA1(0,0,0,1,0,0) + A5xA1(1,0,0,0,0,1) sage: E6(1,0,0,0,0,0).branch(A2xA2xA2, rule="extended") # (0.7s) A2xA2xA2(0,0,0,1,1,0) + A2xA2xA2(0,1,1,0,0,0) + A2xA2xA2(1,0,0,0,0,1) sage: E7=WeylCharacterRing("E7",style="coroots") sage: A7=WeylCharacterRing("A7",style="coroots") sage: E7(1,0,0,0,0,0,0).branch(A7,rule="extended") # long time (5s) A7(0,0,0,1,0,0,0) + A7(1,0,0,0,0,0,1) sage: E8=WeylCharacterRing("E8",cache=true,style="coroots") sage: D8=WeylCharacterRing("D8",cache=true,style="coroots") sage: E8(0,0,0,0,0,0,0,1).branch(D8,rule="extended") # long time (19s) D8(0,0,0,0,0,0,1,0) + D8(0,1,0,0,0,0,0,0) sage: F4(1,0,0,0).branch(A1xC3,rule="extended") # (0.7s) A1xC3(0,2,0,0) + A1xC3(1,0,0,1) + A1xC3(2,0,0,0) sage: G2(0,1).branch(A1xA1, rule="extended") A1xA1(0,2) + A1xA1(2,0) + A1xA1(3,1) sage: F4(0,0,0,1).branch(A2xA2, rule="extended") # (0.4s) A2xA2(0,0,1,1) + A2xA2(0,1,0,1) + A2xA2(1,0,1,0) sage: F4(0,0,0,1).branch(A3xA1,rule="extended") # (0.34s) A3xA1(0,0,0,0) + A3xA1(0,0,0,2) + A3xA1(0,0,1,1) + A3xA1(0,1,0,0) + A3xA1(1,0,0,1) sage: D4=WeylCharacterRing("D4",style="coroots") sage: D2xD2=WeylCharacterRing("D2xD2",style="coroots") # We get D4 => A1xA1xA1xA1 by remembering that A1xA1 = D2. sage: [D4(fw).branch(D2xD2, rule="extended") for fw in D4.fundamental_weights()] [D2xD2(0,0,1,1) + D2xD2(1,1,0,0), D2xD2(0,0,2,0) + D2xD2(0,0,0,2) + D2xD2(2,0,0,0) + D2xD2(1,1,1,1) + D2xD2(0,2,0,0), D2xD2(1,0,0,1) + D2xD2(0,1,1,0), D2xD2(1,0,1,0) + D2xD2(0,1,0,1)] EXAMPLES: (Tensor type) :: sage: A5=WeylCharacterRing("A5", style="coroots") sage: A2xA1=WeylCharacterRing("A2xA1", style="coroots") sage: [A5(hwv).branch(A2xA1, rule="tensor") for hwv in A5.fundamental_weights()] [A2xA1(1,0,1), A2xA1(0,1,2) + A2xA1(2,0,0), A2xA1(0,0,3) + A2xA1(1,1,1), A2xA1(1,0,2) + A2xA1(0,2,0), A2xA1(0,1,1)] sage: B4=WeylCharacterRing("B4",style="coroots") sage: B1xB1=WeylCharacterRing("B1xB1",style="coroots") sage: [B4(f).branch(B1xB1,rule="tensor") for f in B4.fundamental_weights()] [B1xB1(2,2), B1xB1(0,2) + B1xB1(2,0) + B1xB1(2,4) + B1xB1(4,2), B1xB1(0,2) + B1xB1(0,6) + B1xB1(2,0) + B1xB1(2,2) + B1xB1(2,4) + B1xB1(4,2) + B1xB1(4,4) + B1xB1(6,0), B1xB1(1,3) + B1xB1(3,1)] sage: D4=WeylCharacterRing("D4",style="coroots") sage: C2xC1=WeylCharacterRing("C2xC1",style="coroots") sage: [D4(f).branch(C2xC1,rule="tensor") for f in D4.fundamental_weights()] [C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,2) + C2xC1(2,0,0), C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,0)] sage: C3=WeylCharacterRing("C3",style="coroots") sage: B1xC1=WeylCharacterRing("B1xC1",style="coroots") sage: [C3(f).branch(B1xC1,rule="tensor") for f in C3.fundamental_weights()] [B1xC1(2,1), B1xC1(2,2) + B1xC1(4,0), B1xC1(0,3) + B1xC1(4,1)] EXAMPLES: (Symmetric Power) :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: B3=WeylCharacterRing("B3",style="coroots") sage: C3=WeylCharacterRing("C3",style="coroots") sage: [B3(fw).branch(A1,rule="symmetric_power") for fw in B3.fundamental_weights()] [A1(6), A1(2) + A1(6) + A1(10), A1(0) + A1(6)] sage: [C3(fw).branch(A1,rule="symmetric_power") for fw in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] EXAMPLES: (Miscellaneous type) :: sage: G2 = WeylCharacterRing("G2") sage: [fw1, fw2, fw3] = B3.fundamental_weights() sage: B3(fw1+fw3).branch(G2, rule="miscellaneous") G2(1,0,-1) + G2(2,-1,-1) + G2(2,0,-2) EXAMPLES: (Isomorphic type) :: sage: [B2(x).branch(C2, rule="isomorphic") for x in B2.fundamental_weights()] [C2(1,1), C2(1,0)] sage: [C2(x).branch(B2, rule="isomorphic") for x in C2.fundamental_weights()] [B2(1/2,1/2), B2(1,0)] sage: [A3(x).branch(D3,rule="isomorphic") for x in A3.fundamental_weights()] [D3(1/2,1/2,1/2), D3(1,0,0), D3(1/2,1/2,-1/2)] sage: [D3(x).branch(A3,rule="isomorphic") for x in D3.fundamental_weights()] [A3(1/2,1/2,-1/2,-1/2), A3(1/4,1/4,1/4,-3/4), A3(3/4,-1/4,-1/4,-1/4)] Here A3(x,y,z,w) can be understood as a representation of SL(4). The weights x,y,z,w and x+t,y+t,z+t,w+t represent the same representation of SL(4) - though not of GL(4) - since A3(x+t,y+t,z+t,w+t) is the same as A3(x,y,z,w) tensored with `det^t`. So as a representation of SL(4), A3(1/4,1/4,1/4,-3/4) is the same as A3(1,1,1,0). The exterior square representation SL(4) -> GL(6) admits an invariant symmetric bilinear form, so is a representation SL(4) -> SO(6) that lifts to an isomorphism SL(4) -> Spin(6). Conversely, there are two isomorphisms SO(6) -> SL(4), of which we've selected one. In cases like this you might prefer style="coroots". :: sage: A3 = WeylCharacterRing("A3",style="coroots") sage: D3 = WeylCharacterRing("D3",style="coroots") sage: [D3(fw) for fw in D3.fundamental_weights()] [D3(1,0,0), D3(0,1,0), D3(0,0,1)] sage: [D3(fw).branch(A3,rule="isomorphic") for fw in D3.fundamental_weights()] [A3(0,1,0), A3(0,0,1), A3(1,0,0)] sage: D2 = WeylCharacterRing("D2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: [D2(fw).branch(A1xA1,rule="isomorphic") for fw in D2.fundamental_weights()] [A1xA1(1,0), A1xA1(0,1)] EXAMPLES: (Branching rules from plethysms) This is a general rule that includes any branching rule from types A,B,C or D as a special case. Thus it could be used in place of the above rules and would give the same results. However it is most useful when branching from G to a maximal subgroup H such that rank(H) < rank(G)-1. We consider a homomorphism H --> G where G is one of SL(r+1), SO(2r+1), Sp(2r) or SO(2r). The function branching_rule_from_plethysm produces the corresponding branching rule. The main ingredient is the character chi of the representation of H that is the homomorphism to GL(r+1), GL(2r+1) or GL(2r). This rule is so powerful that it contains the other rules implemented above as special cases. First let us consider the symmetric fifth power representation of SL(2). :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: chi=A1([5]) sage: chi.degree() 6 sage: chi.frobenius_schur_indicator() -1 This confirms that the character has degree 6 and is symplectic, so it corresponds to a homomorphism SL(2) --> Sp(6), and there is a corresponding branching rule C3 => A1. :: sage: C3 = WeylCharacterRing("C3",style="coroots") sage: sym5rule = branching_rule_from_plethysm(chi,"C3") sage: [C3(hwv).branch(A1,rule=sym5rule) for hwv in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] This is identical to the results we would obtain using rule="symmetric_power". The next example gives a branching not available by other standard rules. :: sage: G2 = WeylCharacterRing("G2",style="coroots") sage: D7 = WeylCharacterRing("D7",style="coroots") sage: ad=G2(0,1); ad.degree(); ad.frobenius_schur_indicator() 14 1 sage: spin = D7(0,0,0,0,0,1,0); spin.degree() 64 sage: spin.branch(G2, rule=branching_rule_from_plethysm(ad, "D7")) G2(1,1) We have confirmed that the adjoint representation of G2 gives a homomorphism into SO(14), and that the pullback of the one of the two 64 dimensional spin representations to SO(14) is an irreducible representation of G2. BRANCHING FROM A REDUCIBLE ROOT SYSTEM If you are branching from a reducible root system, the rule is a list of rules, one for each component type in the root system. The rules in the list are given in pairs [type, rule], where type is the root system to be branched to, and rule is the branching rule. :: sage: D4 = WeylCharacterRing("D4",style="coroots") sage: D2xD2 = WeylCharacterRing("D2xD2",style="coroots") sage: A1xA1xA1xA1 = WeylCharacterRing("A1xA1xA1xA1",style="coroots") sage: rr = [["A1xA1","isomorphic"],["A1xA1","isomorphic"]] sage: [D4(fw) for fw in D4.fundamental_weights()] [D4(1,0,0,0), D4(0,1,0,0), D4(0,0,1,0), D4(0,0,0,1)] sage: [D4(fw).branch(D2xD2,rule="extended").branch(A1xA1xA1xA1,rule=rr) for fw in D4.fundamental_weights()] [A1xA1xA1xA1(0,0,1,1) + A1xA1xA1xA1(1,1,0,0), A1xA1xA1xA1(0,0,0,2) + A1xA1xA1xA1(0,0,2,0) + A1xA1xA1xA1(0,2,0,0) + A1xA1xA1xA1(1,1,1,1) + A1xA1xA1xA1(2,0,0,0), A1xA1xA1xA1(0,1,1,0) + A1xA1xA1xA1(1,0,0,1), A1xA1xA1xA1(0,1,0,1) + A1xA1xA1xA1(1,0,1,0)] WRITING YOUR OWN RULES Suppose you want to branch from a group G to a subgroup H. Arrange the embedding so that a Cartan subalgebra U of H is contained in a Cartan subalgebra T of G. There is thus a mapping from the weight spaces Lie(T)* --> Lie(U)*. Two embeddings will produce identical branching rules if they differ by an element of the Weyl group of H. The RULE is this map Lie(T)* = G.space() to Lie(U)* = H.space(), which you may implement as a function. As an example, let us consider how to implement the branching rule A3 => C2. Here H = C2 = Sp(4) embedded as a subgroup in A3 = GL(4). The Cartan subalgebra U consists of diagonal matrices with eigenvalues u1, u2, -u2, -u1. The C2.space() is the two dimensional vector spaces consisting of the linear functionals u1 and u2 on U. On the other hand Lie(T) is RR^4. A convenient way to see the restriction is to think of it as the adjoint of the map [u1,u2] -> [u1,u2,-u2,-u1], that is, [x0,x1,x2,x3] -> [x0-x3,x1-x2]. Hence we may encode the rule: :: def rule(x): return [x[0]-x[3],x[1]-x[2]] or simply: :: rule = lambda x : [x[0]-x[3],x[1]-x[2]] EXAMPLES:: sage: A3 = WeylCharacterRing(['A',3]) sage: C2 = WeylCharacterRing(['C',2]) sage: rule = lambda x : [x[0]-x[3],x[1]-x[2]] sage: branch_weyl_character(A3([1,1,0,0]),A3,C2,rule) C2(0,0) + C2(1,1) sage: A3(1,1,0,0).branch(C2, rule) == C2(0,0) + C2(1,1) True """ if type(rule) == str: rule = get_branching_rule(R._cartan_type, S._cartan_type, rule) elif R._cartan_type.is_compound(): Rtypes = R._cartan_type.component_types() Stypes = [CartanType(l[0]) for l in rule] rules = [l[1] for l in rule] ntypes = len(Rtypes) rule_list = [get_branching_rule(Rtypes[i], Stypes[i], rules[i]) for i in range(ntypes)] shifts = R._cartan_type._shifts def rule(x): yl = [] for i in range(ntypes): yl.append(rule_list[i](x[shifts[i]:shifts[i+1]])) return flatten(yl) mdict = {} for k in chi._mdict: if S._style == "coroots": if S._cartan_type.is_atomic() and S._cartan_type[0] == 'E': if S._cartan_type[1] == 6: h = S._space(rule(list(k.to_vector()))) h = S.coerce_to_e6(h) elif S._cartan_type[1] == 7: h = S.coerce_to_e7(S._space(rule(list(k.to_vector())))) else: h = S.coerce_to_sl(S._space(rule(list(k.to_vector())))) else: h = S._space(rule(list(k.to_vector()))) if h in mdict: mdict[h] += chi._mdict[k] else: mdict[h] = chi._mdict[k] hdict = S.char_from_weights(mdict) return WeylCharacter(S, hdict, mdict)
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
SYMMETRIC TYPE. Related to the automorphic type, when either the Dynkin diagram or the extended diagram has a symmetry there is a branching rule to the subalgebra (or subgroup) of invariants under the automorphism. Use rule="symmetric".
SYMMETRIC TYPE. Related to the automorphic type, when G admits an outer automorphism (usually of degree 2) we may consider the branching rule to the isotropy subgroup H. In many cases the Dynkin diagram of H can be obtained by folding the Dynkin diagram of G. For such isotropy subgroups use rule="symmetric".
def branch_weyl_character(chi, R, S, rule="default"): r""" A Branching rule describes the restriction of representations from a Lie group or algebra G to a smaller one. See for example, R. C. King, Branching rules for classical Lie groups using tensor and spinor methods. J. Phys. A 8 (1975), 429-449, Howe, Tan and Willenbring, Stable branching rules for classical symmetric pairs, Trans. Amer. Math. Soc. 357 (2005), no. 4, 1601-1626, McKay and Patera, Tables of Dimensions, Indices and Branching Rules for Representations of Simple Lie Algebras (Marcel Dekker, 1981), and Fauser, Jarvis, King and Wybourne, New branching rules induced by plethysm. J. Phys. A 39 (2006), no. 11, 2611--2655. INPUT: - ``chi`` - a character of G - ``R`` - the Weyl Character Ring of G - ``S`` - the Weyl Character Ring of H - ``rule`` - a set of r dominant weights in H where r is the rank of G. You may use a predefined rule by specifying rule = one of"levi", "automorphic", "symmetric", "extended", "triality" or "miscellaneous". The use of these rules will be explained next. After the examples we will explain how to write your own branching rules for cases that we have omitted. To explain the predefined rules we survey the most important branching rules. These may be classified into several cases, and once this is understood, the detailed classification can be read off from the Dynkin diagrams. Dynkin classified the maximal subgroups of Lie groups in Mat. Sbornik N.S. 30(72):349-462 (1952). We will list give predefined rules that cover most cases where the branching rule is to a maximal subgroup. For convenience, we also give some branching rules to subgroups that are not maximal. For example, a Levi subgroup may or may not be maximal. LEVI TYPE. These can be read off from the Dynkin diagram. If removing a node from the Dynkin diagram produces another Dynkin diagram, there is a branching rule. Currently we require that the smaller diagram be connected. For these rules use the option rule="levi":: ['A',r] => ['A',r-1] ['B',r] => ['A',r-1] ['B',r] => ['B',r-1] ['C',r] => ['A',r-1] ['C',r] => ['C',r-1] ['D',r] => ['A',r-1] ['D',r] => ['D',r-1] ['E',r] => ['A',r-1] r = 7,8 ['E',r] => ['D',r-1] r = 6,7,8 ['E',r] => ['E',r-1] F4 => B3 F4 => C3 G2 => A1 (short root) Not all Levi subgroups are maximal subgroups. If the Levi is not maximal there may or may not be a preprogrammed rule="levi" for it. If there is not, the branching rule may still be obtained by going through an intermediate subgroup that is maximal using rule="extended". Thus the other Levi branching rule from G2 => A1 corresponding to the long root is available by first branching G2 => A_2 then A2 => A1. Similarly the branching rules to the Levi subgroup:: ['E',r] => ['A',r-1] r = 6,7,8 may be obtained by first branching E6=>A5xA1, E7=>A7 or E8=>A8. AUTOMORPHIC TYPE. If the Dynkin diagram has a symmetry, then there is an automorphism that is a special case of a branching rule. There is also an exotic "triality" automorphism of D4 having order 3. Use rule="automorphic" or (for D4) rule="triality":: ['A',r] => ['A',r] ['D',r] => ['D',r] E6 => E6 SYMMETRIC TYPE. Related to the automorphic type, when either the Dynkin diagram or the extended diagram has a symmetry there is a branching rule to the subalgebra (or subgroup) of invariants under the automorphism. Use rule="symmetric". The last branching rule, D4=>G2 is not to a maximal subgroup since D4=>B3=>G2, but it is included for convenience. :: ['A',2r+1] => ['B',r] ['A',2r] => ['C',r] ['A',2r] => ['D',r] ['D',r] => ['B',r-1] E6 => F4 D4 => G2 EXTENDED TYPE. If removing a node from the extended Dynkin diagram results in a Dynkin diagram, then there is a branching rule. Use rule="extended" for these. We will also use this classification for some rules that are not of this type, mainly involving type B, such as D6 => B3xB3. Here is the extended Dynkin diagram for D6:: 0 6 O O | | | | O---O---O---O---O 1 2 3 4 6 Removing the node 3 results in an embedding D3xD3 -> D6. This corresponds to the embedding SO(6)xSO(6) -> SO(12), and is of extended type. On the other hand the embedding SO(5)xSO(7)-->SO(12) (e.g. B2xB3 -> D6) cannot be explained this way but for uniformity is implemented under rule="extended". Using rule="extended" you can get any branching rule SO(n) => SO(a) x SO(b) x SO(c) x ... where n = a+b+c+ ... Sp(2n) => Sp(2a) x Sp(2b) x Sp(2c) x ... where n = a+b+c+ ... where O(a) = ['D',r] (a=2r) or ['B',r] (a=2r+1) and Sp(2r)=['C',r]. The following rules are implemented as special cases of rule="extended". :: E6 => A5xA1, A2xA2xA2 E7 => A7, D6xA1, A3xA3xA1 E8 => A8, D8, E7xA1, A4xA4, D5xA3, E6xA2 F4 => B4, C3xA1, A2xA2, A3xA1 G2 => A1xA1 Note that E8 has only a limited number of representations of reasonably low degree. TENSOR: There are branching rules: :: ['A', rs-1] => ['A',r-1] x ['A',s-1] ['B',2rs+r+s] => ['B',r] x ['B',s] ['D',2rs+s] => ['B',r] x ['D',s] ['D',2rs] => ['D',r] x ['D',s] ['D',2rs] => ['C',r] x ['C',s] ['C',2rs+s] => ['B',r] x ['C',s] ['C',2rs] => ['C',r] x ['D',s]. corresponding to the tensor product homomorphism. For type A, the homomorphism is GL(r) x GL(s) -> GL(rs). For the classical types, the relevant fact is that if V,W are orthogonal or symplectic spaces, that is, spaces endowed with symmetric or skew-symmetric bilinear forms, then V tensor W is also an orthogonal space (if V and W are both orthogonal or both symplectic) or symplectic (if one of V and W is orthogonal and the other symplectic). The corresponding branching rules are obtained using rule="tensor". SYMMETRIC POWER: The k-th symmetric and exterior power homomorphisms map GL(n) --> GL(binomial(n+k-1,k)) and GL(binomial(n,k)). The corresponding branching rules are not implemented but a special case is. The k-th symmetric power homomorphism SL(2) --> GL(k+1) has its image inside of SO(2r+1) if k=2r and inside of Sp(2r) if k=2r-1. Hence there are branching rules:: ['B',r] => A1 ['C',r] => A1 and these may be obtained using the rule "symmetric_power". MISCELLANEOUS: Use rule="miscellaneous" for the following rules:: B3 => G2 F4 => G2xA1 (not implemented yet) BRANCHING RULES FROM PLETHYSMS Nearly all branching rules G => H where G is of type A,B,C or D are covered by the preceding rules. The function branching_rules_from_plethysm covers the remaining cases. ISOMORPHIC TYPE: Although not usually referred to as a branching rule, the effects of the accidental isomorphisms may be handled using rule="isomorphic":: B2 => C2 C2 => B2 A3 => D3 D3 => A3 D2 => A1xA1 B1 => A1 C1 => A1 EXAMPLES: (Levi type) :: sage: A1 = WeylCharacterRing("A1") sage: A2 = WeylCharacterRing("A2") sage: A3 = WeylCharacterRing("A3") sage: A4 = WeylCharacterRing("A4") sage: A5 = WeylCharacterRing("A5") sage: B2 = WeylCharacterRing("B2") sage: B3 = WeylCharacterRing("B3") sage: B4 = WeylCharacterRing("B4") sage: C2 = WeylCharacterRing("C2") sage: C3 = WeylCharacterRing("C3") sage: D3 = WeylCharacterRing("D3") sage: D4 = WeylCharacterRing("D4") sage: D5 = WeylCharacterRing("D5") sage: G2 = WeylCharacterRing("G2") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: [B3(w).branch(A2,rule="levi") for w in B3.fundamental_weights()] [A2(0,0,-1) + A2(0,0,0) + A2(1,0,0), A2(0,-1,-1) + A2(0,0,-1) + A2(0,0,0) + A2(1,0,-1) + A2(1,0,0) + A2(1,1,0), A2(-1/2,-1/2,-1/2) + A2(1/2,-1/2,-1/2) + A2(1/2,1/2,-1/2) + A2(1/2,1/2,1/2)] The last example must be understood as follows. The representation of B3 being branched is spin, which is not a representation of SO(7) but of its double cover spin(7). The group A2 is really GL(3) and the double cover of SO(7) induces a cover of GL(3) that is trivial over SL(3) but not over the center of GL(3). The weight lattice for this GL(3) consists of triples (a,b,c) of half integers such that a-b and b-c are in `\ZZ`, and this is reflected in the last decomposition. :: sage: [C3(w).branch(A2,rule="levi") for w in C3.fundamental_weights()] [A2(0,0,-1) + A2(1,0,0), A2(0,-1,-1) + A2(1,0,-1) + A2(1,1,0), A2(-1,-1,-1) + A2(1,-1,-1) + A2(1,1,-1) + A2(1,1,1)] sage: [D4(w).branch(A3,rule="levi") for w in D4.fundamental_weights()] [A3(0,0,0,-1) + A3(1,0,0,0), A3(0,0,-1,-1) + A3(0,0,0,0) + A3(1,0,0,-1) + A3(1,1,0,0), A3(1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,-1/2), A3(-1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,1/2)] sage: [B3(w).branch(B2,rule="levi") for w in B3.fundamental_weights()] [2*B2(0,0) + B2(1,0), B2(0,0) + 2*B2(1,0) + B2(1,1), 2*B2(1/2,1/2)] sage: C3 = WeylCharacterRing(['C',3]) sage: [C3(w).branch(C2,rule="levi") for w in C3.fundamental_weights()] [2*C2(0,0) + C2(1,0), C2(0,0) + 2*C2(1,0) + C2(1,1), C2(1,0) + 2*C2(1,1)] sage: [D5(w).branch(D4,rule="levi") for w in D5.fundamental_weights()] [2*D4(0,0,0,0) + D4(1,0,0,0), D4(0,0,0,0) + 2*D4(1,0,0,0) + D4(1,1,0,0), D4(1,0,0,0) + 2*D4(1,1,0,0) + D4(1,1,1,0), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2)] sage: G2(1,0,-1).branch(A1,rule="levi") A1(0,-1) + A1(1,-1) + A1(1,0) sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: fw = E6.fundamental_weights() sage: [E6(fw[i]).branch(D5,rule="levi") for i in [1,2,6]] # long time (3s) [D5(0,0,0,0,0) + D5(0,0,0,0,1) + D5(1,0,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(0,0,0,0,1) + D5(0,1,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(1,0,0,0,0)] sage: E7=WeylCharacterRing("E7",style="coroots") sage: D6=WeylCharacterRing("D6",style="coroots") sage: fw = E7.fundamental_weights() sage: [E7(fw[i]).branch(D6,rule="levi") for i in [1,2,7]] # long time (26s) [3*D6(0,0,0,0,0,0) + 2*D6(0,0,0,0,1,0) + D6(0,1,0,0,0,0), 3*D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0) + 2*D6(0,0,1,0,0,0) + D6(1,0,0,0,1,0), D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0)] sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8=WeylCharacterRing("E8",style="coroots",cache=True) sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8(1,0,0,0,0,0,0,0).branch(D7,rule="levi") # not tested (very long time) (160s) 3*D7(0,0,0,0,0,0,0) + 2*D7(0,0,0,0,0,1,0) + 2*D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) + 2*D7(0,0,1,0,0,0,0) + D7(0,0,0,1,0,0,0) + D7(1,0,0,0,0,1,0) + D7(1,0,0,0,0,0,1) + D7(2,0,0,0,0,0,0) sage: E8(0,0,0,0,0,0,0,1).branch(D7,rule="levi") # long time (3s) D7(0,0,0,0,0,0,0) + D7(0,0,0,0,0,1,0) + D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) sage: [F4(fw).branch(B3,rule="levi") for fw in F4.fundamental_weights()] # long time (36s) [B3(0,0,0) + 2*B3(1/2,1/2,1/2) + 2*B3(1,0,0) + B3(1,1,0), B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 5*B3(1,0,0) + 7*B3(1,1,0) + 3*B3(1,1,1) + 6*B3(3/2,1/2,1/2) + 2*B3(3/2,3/2,1/2) + B3(2,0,0) + 2*B3(2,1,0) + B3(2,1,1), 3*B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 4*B3(1,0,0) + 3*B3(1,1,0) + B3(1,1,1) + 2*B3(3/2,1/2,1/2), 3*B3(0,0,0) + 2*B3(1/2,1/2,1/2) + B3(1,0,0)] sage: [F4(fw).branch(C3,rule="levi") for fw in F4.fundamental_weights()] # long time (6s) [3*C3(0,0,0) + 2*C3(1,1,1) + C3(2,0,0), 3*C3(0,0,0) + 6*C3(1,1,1) + 4*C3(2,0,0) + 2*C3(2,1,0) + 3*C3(2,2,0) + C3(2,2,2) + C3(3,1,0) + 2*C3(3,1,1), 2*C3(1,0,0) + 3*C3(1,1,0) + C3(2,0,0) + 2*C3(2,1,0) + C3(2,1,1), 2*C3(1,0,0) + C3(1,1,0)] sage: A1xA1 = WeylCharacterRing("A1xA1") sage: [A3(hwv).branch(A1xA1,rule="levi") for hwv in A3.fundamental_weights()] [A1xA1(0,0,1,0) + A1xA1(1,0,0,0), A1xA1(0,0,1,1) + A1xA1(1,0,1,0) + A1xA1(1,1,0,0), A1xA1(1,0,1,1) + A1xA1(1,1,1,0)] sage: A1xB1=WeylCharacterRing("A1xB1",style="coroots") sage: [B3(x).branch(A1xB1,rule="levi") for x in B3.fundamental_weights()] [A1xB1(0,2) + 2*A1xB1(1,0), 3*A1xB1(0,0) + A1xB1(0,2) + 2*A1xB1(1,2) + A1xB1(2,0), 2*A1xB1(0,1) + A1xB1(1,1)] EXAMPLES: (Automorphic type, including D4 triality) :: sage: [A3(chi).branch(A3,rule="automorphic") for chi in A3.fundamental_weights()] [A3(0,0,0,-1), A3(0,0,-1,-1), A3(0,-1,-1,-1)] sage: [D4(chi).branch(D4,rule="automorphic") for chi in D4.fundamental_weights()] [D4(1,0,0,0), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2)] sage: [D4(chi).branch(D4,rule="triality") for chi in D4.fundamental_weights()] [D4(1/2,1/2,1/2,-1/2), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1,0,0,0)] EXAMPLES: (Symmetric type) :: sage: [w.branch(B2,rule="symmetric") for w in [A4(1,0,0,0,0),A4(1,1,0,0,0),A4(1,1,1,0,0),A4(2,0,0,0,0)]] [B2(1,0), B2(1,1), B2(1,1), B2(0,0) + B2(2,0)] sage: [A5(w).branch(C3,rule="symmetric") for w in A5.fundamental_weights()] [C3(1,0,0), C3(0,0,0) + C3(1,1,0), C3(1,0,0) + C3(1,1,1), C3(0,0,0) + C3(1,1,0), C3(1,0,0)] sage: [A5(w).branch(D3,rule="symmetric") for w in A5.fundamental_weights()] [D3(1,0,0), D3(1,1,0), D3(1,1,-1) + D3(1,1,1), D3(1,1,0), D3(1,0,0)] sage: [D4(x).branch(B3,rule="symmetric") for x in D4.fundamental_weights()] [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(1,1,0), B3(1/2,1/2,1/2), B3(1/2,1/2,1/2)] sage: [D4(x).branch(G2,rule="symmetric") for x in D4.fundamental_weights()] [G2(0,0,0) + G2(1,0,-1), 2*G2(1,0,-1) + G2(2,-1,-1), G2(0,0,0) + G2(1,0,-1), G2(0,0,0) + G2(1,0,-1)] sage: [E6(fw).branch(F4,rule="symmetric") for fw in E6.fundamental_weights()] # long time (36s) [F4(0,0,0,0) + F4(0,0,0,1), F4(0,0,0,1) + F4(1,0,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(1,0,0,0) + 2*F4(0,0,1,0) + F4(1,0,0,1) + F4(0,1,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(0,0,0,0) + F4(0,0,0,1)] EXAMPLES: (Extended type) :: sage: [B3(x).branch(D3,rule="extended") for x in B3.fundamental_weights()] [D3(0,0,0) + D3(1,0,0), D3(1,0,0) + D3(1,1,0), D3(1/2,1/2,-1/2) + D3(1/2,1/2,1/2)] sage: [G2(w).branch(A2, rule="extended") for w in G2.fundamental_weights()] [A2(0,0,0) + A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3), A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3) + A2(1,0,-1)] sage: [F4(fw).branch(B4,rule="extended") for fw in F4.fundamental_weights()] # long time (9s) [B4(1/2,1/2,1/2,1/2) + B4(1,1,0,0), B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2) + B4(3/2,3/2,1/2,1/2) + B4(2,1,1,0), B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0) + B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2), B4(0,0,0,0) + B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0)] sage: E6 = WeylCharacterRing("E6", style="coroots") sage: A2xA2xA2=WeylCharacterRing("A2xA2xA2",style="coroots") sage: A5xA1=WeylCharacterRing("A5xA1",style="coroots") sage: G2 = WeylCharacterRing("G2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: A3xA1 = WeylCharacterRing("A3xA1", style="coroots") sage: A2xA2 = WeylCharacterRing("A2xA2", style="coroots") sage: A1xC3 = WeylCharacterRing("A1xC3",style="coroots") sage: E6(1,0,0,0,0,0).branch(A5xA1,rule="extended") # (0.7s) A5xA1(0,0,0,1,0,0) + A5xA1(1,0,0,0,0,1) sage: E6(1,0,0,0,0,0).branch(A2xA2xA2, rule="extended") # (0.7s) A2xA2xA2(0,0,0,1,1,0) + A2xA2xA2(0,1,1,0,0,0) + A2xA2xA2(1,0,0,0,0,1) sage: E7=WeylCharacterRing("E7",style="coroots") sage: A7=WeylCharacterRing("A7",style="coroots") sage: E7(1,0,0,0,0,0,0).branch(A7,rule="extended") # long time (5s) A7(0,0,0,1,0,0,0) + A7(1,0,0,0,0,0,1) sage: E8=WeylCharacterRing("E8",cache=true,style="coroots") sage: D8=WeylCharacterRing("D8",cache=true,style="coroots") sage: E8(0,0,0,0,0,0,0,1).branch(D8,rule="extended") # long time (19s) D8(0,0,0,0,0,0,1,0) + D8(0,1,0,0,0,0,0,0) sage: F4(1,0,0,0).branch(A1xC3,rule="extended") # (0.7s) A1xC3(0,2,0,0) + A1xC3(1,0,0,1) + A1xC3(2,0,0,0) sage: G2(0,1).branch(A1xA1, rule="extended") A1xA1(0,2) + A1xA1(2,0) + A1xA1(3,1) sage: F4(0,0,0,1).branch(A2xA2, rule="extended") # (0.4s) A2xA2(0,0,1,1) + A2xA2(0,1,0,1) + A2xA2(1,0,1,0) sage: F4(0,0,0,1).branch(A3xA1,rule="extended") # (0.34s) A3xA1(0,0,0,0) + A3xA1(0,0,0,2) + A3xA1(0,0,1,1) + A3xA1(0,1,0,0) + A3xA1(1,0,0,1) sage: D4=WeylCharacterRing("D4",style="coroots") sage: D2xD2=WeylCharacterRing("D2xD2",style="coroots") # We get D4 => A1xA1xA1xA1 by remembering that A1xA1 = D2. sage: [D4(fw).branch(D2xD2, rule="extended") for fw in D4.fundamental_weights()] [D2xD2(0,0,1,1) + D2xD2(1,1,0,0), D2xD2(0,0,2,0) + D2xD2(0,0,0,2) + D2xD2(2,0,0,0) + D2xD2(1,1,1,1) + D2xD2(0,2,0,0), D2xD2(1,0,0,1) + D2xD2(0,1,1,0), D2xD2(1,0,1,0) + D2xD2(0,1,0,1)] EXAMPLES: (Tensor type) :: sage: A5=WeylCharacterRing("A5", style="coroots") sage: A2xA1=WeylCharacterRing("A2xA1", style="coroots") sage: [A5(hwv).branch(A2xA1, rule="tensor") for hwv in A5.fundamental_weights()] [A2xA1(1,0,1), A2xA1(0,1,2) + A2xA1(2,0,0), A2xA1(0,0,3) + A2xA1(1,1,1), A2xA1(1,0,2) + A2xA1(0,2,0), A2xA1(0,1,1)] sage: B4=WeylCharacterRing("B4",style="coroots") sage: B1xB1=WeylCharacterRing("B1xB1",style="coroots") sage: [B4(f).branch(B1xB1,rule="tensor") for f in B4.fundamental_weights()] [B1xB1(2,2), B1xB1(0,2) + B1xB1(2,0) + B1xB1(2,4) + B1xB1(4,2), B1xB1(0,2) + B1xB1(0,6) + B1xB1(2,0) + B1xB1(2,2) + B1xB1(2,4) + B1xB1(4,2) + B1xB1(4,4) + B1xB1(6,0), B1xB1(1,3) + B1xB1(3,1)] sage: D4=WeylCharacterRing("D4",style="coroots") sage: C2xC1=WeylCharacterRing("C2xC1",style="coroots") sage: [D4(f).branch(C2xC1,rule="tensor") for f in D4.fundamental_weights()] [C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,2) + C2xC1(2,0,0), C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,0)] sage: C3=WeylCharacterRing("C3",style="coroots") sage: B1xC1=WeylCharacterRing("B1xC1",style="coroots") sage: [C3(f).branch(B1xC1,rule="tensor") for f in C3.fundamental_weights()] [B1xC1(2,1), B1xC1(2,2) + B1xC1(4,0), B1xC1(0,3) + B1xC1(4,1)] EXAMPLES: (Symmetric Power) :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: B3=WeylCharacterRing("B3",style="coroots") sage: C3=WeylCharacterRing("C3",style="coroots") sage: [B3(fw).branch(A1,rule="symmetric_power") for fw in B3.fundamental_weights()] [A1(6), A1(2) + A1(6) + A1(10), A1(0) + A1(6)] sage: [C3(fw).branch(A1,rule="symmetric_power") for fw in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] EXAMPLES: (Miscellaneous type) :: sage: G2 = WeylCharacterRing("G2") sage: [fw1, fw2, fw3] = B3.fundamental_weights() sage: B3(fw1+fw3).branch(G2, rule="miscellaneous") G2(1,0,-1) + G2(2,-1,-1) + G2(2,0,-2) EXAMPLES: (Isomorphic type) :: sage: [B2(x).branch(C2, rule="isomorphic") for x in B2.fundamental_weights()] [C2(1,1), C2(1,0)] sage: [C2(x).branch(B2, rule="isomorphic") for x in C2.fundamental_weights()] [B2(1/2,1/2), B2(1,0)] sage: [A3(x).branch(D3,rule="isomorphic") for x in A3.fundamental_weights()] [D3(1/2,1/2,1/2), D3(1,0,0), D3(1/2,1/2,-1/2)] sage: [D3(x).branch(A3,rule="isomorphic") for x in D3.fundamental_weights()] [A3(1/2,1/2,-1/2,-1/2), A3(1/4,1/4,1/4,-3/4), A3(3/4,-1/4,-1/4,-1/4)] Here A3(x,y,z,w) can be understood as a representation of SL(4). The weights x,y,z,w and x+t,y+t,z+t,w+t represent the same representation of SL(4) - though not of GL(4) - since A3(x+t,y+t,z+t,w+t) is the same as A3(x,y,z,w) tensored with `det^t`. So as a representation of SL(4), A3(1/4,1/4,1/4,-3/4) is the same as A3(1,1,1,0). The exterior square representation SL(4) -> GL(6) admits an invariant symmetric bilinear form, so is a representation SL(4) -> SO(6) that lifts to an isomorphism SL(4) -> Spin(6). Conversely, there are two isomorphisms SO(6) -> SL(4), of which we've selected one. In cases like this you might prefer style="coroots". :: sage: A3 = WeylCharacterRing("A3",style="coroots") sage: D3 = WeylCharacterRing("D3",style="coroots") sage: [D3(fw) for fw in D3.fundamental_weights()] [D3(1,0,0), D3(0,1,0), D3(0,0,1)] sage: [D3(fw).branch(A3,rule="isomorphic") for fw in D3.fundamental_weights()] [A3(0,1,0), A3(0,0,1), A3(1,0,0)] sage: D2 = WeylCharacterRing("D2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: [D2(fw).branch(A1xA1,rule="isomorphic") for fw in D2.fundamental_weights()] [A1xA1(1,0), A1xA1(0,1)] EXAMPLES: (Branching rules from plethysms) This is a general rule that includes any branching rule from types A,B,C or D as a special case. Thus it could be used in place of the above rules and would give the same results. However it is most useful when branching from G to a maximal subgroup H such that rank(H) < rank(G)-1. We consider a homomorphism H --> G where G is one of SL(r+1), SO(2r+1), Sp(2r) or SO(2r). The function branching_rule_from_plethysm produces the corresponding branching rule. The main ingredient is the character chi of the representation of H that is the homomorphism to GL(r+1), GL(2r+1) or GL(2r). This rule is so powerful that it contains the other rules implemented above as special cases. First let us consider the symmetric fifth power representation of SL(2). :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: chi=A1([5]) sage: chi.degree() 6 sage: chi.frobenius_schur_indicator() -1 This confirms that the character has degree 6 and is symplectic, so it corresponds to a homomorphism SL(2) --> Sp(6), and there is a corresponding branching rule C3 => A1. :: sage: C3 = WeylCharacterRing("C3",style="coroots") sage: sym5rule = branching_rule_from_plethysm(chi,"C3") sage: [C3(hwv).branch(A1,rule=sym5rule) for hwv in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] This is identical to the results we would obtain using rule="symmetric_power". The next example gives a branching not available by other standard rules. :: sage: G2 = WeylCharacterRing("G2",style="coroots") sage: D7 = WeylCharacterRing("D7",style="coroots") sage: ad=G2(0,1); ad.degree(); ad.frobenius_schur_indicator() 14 1 sage: spin = D7(0,0,0,0,0,1,0); spin.degree() 64 sage: spin.branch(G2, rule=branching_rule_from_plethysm(ad, "D7")) G2(1,1) We have confirmed that the adjoint representation of G2 gives a homomorphism into SO(14), and that the pullback of the one of the two 64 dimensional spin representations to SO(14) is an irreducible representation of G2. BRANCHING FROM A REDUCIBLE ROOT SYSTEM If you are branching from a reducible root system, the rule is a list of rules, one for each component type in the root system. The rules in the list are given in pairs [type, rule], where type is the root system to be branched to, and rule is the branching rule. :: sage: D4 = WeylCharacterRing("D4",style="coroots") sage: D2xD2 = WeylCharacterRing("D2xD2",style="coroots") sage: A1xA1xA1xA1 = WeylCharacterRing("A1xA1xA1xA1",style="coroots") sage: rr = [["A1xA1","isomorphic"],["A1xA1","isomorphic"]] sage: [D4(fw) for fw in D4.fundamental_weights()] [D4(1,0,0,0), D4(0,1,0,0), D4(0,0,1,0), D4(0,0,0,1)] sage: [D4(fw).branch(D2xD2,rule="extended").branch(A1xA1xA1xA1,rule=rr) for fw in D4.fundamental_weights()] [A1xA1xA1xA1(0,0,1,1) + A1xA1xA1xA1(1,1,0,0), A1xA1xA1xA1(0,0,0,2) + A1xA1xA1xA1(0,0,2,0) + A1xA1xA1xA1(0,2,0,0) + A1xA1xA1xA1(1,1,1,1) + A1xA1xA1xA1(2,0,0,0), A1xA1xA1xA1(0,1,1,0) + A1xA1xA1xA1(1,0,0,1), A1xA1xA1xA1(0,1,0,1) + A1xA1xA1xA1(1,0,1,0)] WRITING YOUR OWN RULES Suppose you want to branch from a group G to a subgroup H. Arrange the embedding so that a Cartan subalgebra U of H is contained in a Cartan subalgebra T of G. There is thus a mapping from the weight spaces Lie(T)* --> Lie(U)*. Two embeddings will produce identical branching rules if they differ by an element of the Weyl group of H. The RULE is this map Lie(T)* = G.space() to Lie(U)* = H.space(), which you may implement as a function. As an example, let us consider how to implement the branching rule A3 => C2. Here H = C2 = Sp(4) embedded as a subgroup in A3 = GL(4). The Cartan subalgebra U consists of diagonal matrices with eigenvalues u1, u2, -u2, -u1. The C2.space() is the two dimensional vector spaces consisting of the linear functionals u1 and u2 on U. On the other hand Lie(T) is RR^4. A convenient way to see the restriction is to think of it as the adjoint of the map [u1,u2] -> [u1,u2,-u2,-u1], that is, [x0,x1,x2,x3] -> [x0-x3,x1-x2]. Hence we may encode the rule: :: def rule(x): return [x[0]-x[3],x[1]-x[2]] or simply: :: rule = lambda x : [x[0]-x[3],x[1]-x[2]] EXAMPLES:: sage: A3 = WeylCharacterRing(['A',3]) sage: C2 = WeylCharacterRing(['C',2]) sage: rule = lambda x : [x[0]-x[3],x[1]-x[2]] sage: branch_weyl_character(A3([1,1,0,0]),A3,C2,rule) C2(0,0) + C2(1,1) sage: A3(1,1,0,0).branch(C2, rule) == C2(0,0) + C2(1,1) True """ if type(rule) == str: rule = get_branching_rule(R._cartan_type, S._cartan_type, rule) elif R._cartan_type.is_compound(): Rtypes = R._cartan_type.component_types() Stypes = [CartanType(l[0]) for l in rule] rules = [l[1] for l in rule] ntypes = len(Rtypes) rule_list = [get_branching_rule(Rtypes[i], Stypes[i], rules[i]) for i in range(ntypes)] shifts = R._cartan_type._shifts def rule(x): yl = [] for i in range(ntypes): yl.append(rule_list[i](x[shifts[i]:shifts[i+1]])) return flatten(yl) mdict = {} for k in chi._mdict: if S._style == "coroots": if S._cartan_type.is_atomic() and S._cartan_type[0] == 'E': if S._cartan_type[1] == 6: h = S._space(rule(list(k.to_vector()))) h = S.coerce_to_e6(h) elif S._cartan_type[1] == 7: h = S.coerce_to_e7(S._space(rule(list(k.to_vector())))) else: h = S.coerce_to_sl(S._space(rule(list(k.to_vector())))) else: h = S._space(rule(list(k.to_vector()))) if h in mdict: mdict[h] += chi._mdict[k] else: mdict[h] = chi._mdict[k] hdict = S.char_from_weights(mdict) return WeylCharacter(S, hdict, mdict)
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
Using rule="extended" you can get any branching rule SO(n) => SO(a) x SO(b) x SO(c) x ... where n = a+b+c+ ... Sp(2n) => Sp(2a) x Sp(2b) x Sp(2c) x ... where n = a+b+c+ ... where O(a) = ['D',r] (a=2r) or ['B',r] (a=2r+1) and Sp(2r)=['C',r].
def branch_weyl_character(chi, R, S, rule="default"): r""" A Branching rule describes the restriction of representations from a Lie group or algebra G to a smaller one. See for example, R. C. King, Branching rules for classical Lie groups using tensor and spinor methods. J. Phys. A 8 (1975), 429-449, Howe, Tan and Willenbring, Stable branching rules for classical symmetric pairs, Trans. Amer. Math. Soc. 357 (2005), no. 4, 1601-1626, McKay and Patera, Tables of Dimensions, Indices and Branching Rules for Representations of Simple Lie Algebras (Marcel Dekker, 1981), and Fauser, Jarvis, King and Wybourne, New branching rules induced by plethysm. J. Phys. A 39 (2006), no. 11, 2611--2655. INPUT: - ``chi`` - a character of G - ``R`` - the Weyl Character Ring of G - ``S`` - the Weyl Character Ring of H - ``rule`` - a set of r dominant weights in H where r is the rank of G. You may use a predefined rule by specifying rule = one of"levi", "automorphic", "symmetric", "extended", "triality" or "miscellaneous". The use of these rules will be explained next. After the examples we will explain how to write your own branching rules for cases that we have omitted. To explain the predefined rules we survey the most important branching rules. These may be classified into several cases, and once this is understood, the detailed classification can be read off from the Dynkin diagrams. Dynkin classified the maximal subgroups of Lie groups in Mat. Sbornik N.S. 30(72):349-462 (1952). We will list give predefined rules that cover most cases where the branching rule is to a maximal subgroup. For convenience, we also give some branching rules to subgroups that are not maximal. For example, a Levi subgroup may or may not be maximal. LEVI TYPE. These can be read off from the Dynkin diagram. If removing a node from the Dynkin diagram produces another Dynkin diagram, there is a branching rule. Currently we require that the smaller diagram be connected. For these rules use the option rule="levi":: ['A',r] => ['A',r-1] ['B',r] => ['A',r-1] ['B',r] => ['B',r-1] ['C',r] => ['A',r-1] ['C',r] => ['C',r-1] ['D',r] => ['A',r-1] ['D',r] => ['D',r-1] ['E',r] => ['A',r-1] r = 7,8 ['E',r] => ['D',r-1] r = 6,7,8 ['E',r] => ['E',r-1] F4 => B3 F4 => C3 G2 => A1 (short root) Not all Levi subgroups are maximal subgroups. If the Levi is not maximal there may or may not be a preprogrammed rule="levi" for it. If there is not, the branching rule may still be obtained by going through an intermediate subgroup that is maximal using rule="extended". Thus the other Levi branching rule from G2 => A1 corresponding to the long root is available by first branching G2 => A_2 then A2 => A1. Similarly the branching rules to the Levi subgroup:: ['E',r] => ['A',r-1] r = 6,7,8 may be obtained by first branching E6=>A5xA1, E7=>A7 or E8=>A8. AUTOMORPHIC TYPE. If the Dynkin diagram has a symmetry, then there is an automorphism that is a special case of a branching rule. There is also an exotic "triality" automorphism of D4 having order 3. Use rule="automorphic" or (for D4) rule="triality":: ['A',r] => ['A',r] ['D',r] => ['D',r] E6 => E6 SYMMETRIC TYPE. Related to the automorphic type, when either the Dynkin diagram or the extended diagram has a symmetry there is a branching rule to the subalgebra (or subgroup) of invariants under the automorphism. Use rule="symmetric". The last branching rule, D4=>G2 is not to a maximal subgroup since D4=>B3=>G2, but it is included for convenience. :: ['A',2r+1] => ['B',r] ['A',2r] => ['C',r] ['A',2r] => ['D',r] ['D',r] => ['B',r-1] E6 => F4 D4 => G2 EXTENDED TYPE. If removing a node from the extended Dynkin diagram results in a Dynkin diagram, then there is a branching rule. Use rule="extended" for these. We will also use this classification for some rules that are not of this type, mainly involving type B, such as D6 => B3xB3. Here is the extended Dynkin diagram for D6:: 0 6 O O | | | | O---O---O---O---O 1 2 3 4 6 Removing the node 3 results in an embedding D3xD3 -> D6. This corresponds to the embedding SO(6)xSO(6) -> SO(12), and is of extended type. On the other hand the embedding SO(5)xSO(7)-->SO(12) (e.g. B2xB3 -> D6) cannot be explained this way but for uniformity is implemented under rule="extended". Using rule="extended" you can get any branching rule SO(n) => SO(a) x SO(b) x SO(c) x ... where n = a+b+c+ ... Sp(2n) => Sp(2a) x Sp(2b) x Sp(2c) x ... where n = a+b+c+ ... where O(a) = ['D',r] (a=2r) or ['B',r] (a=2r+1) and Sp(2r)=['C',r]. The following rules are implemented as special cases of rule="extended". :: E6 => A5xA1, A2xA2xA2 E7 => A7, D6xA1, A3xA3xA1 E8 => A8, D8, E7xA1, A4xA4, D5xA3, E6xA2 F4 => B4, C3xA1, A2xA2, A3xA1 G2 => A1xA1 Note that E8 has only a limited number of representations of reasonably low degree. TENSOR: There are branching rules: :: ['A', rs-1] => ['A',r-1] x ['A',s-1] ['B',2rs+r+s] => ['B',r] x ['B',s] ['D',2rs+s] => ['B',r] x ['D',s] ['D',2rs] => ['D',r] x ['D',s] ['D',2rs] => ['C',r] x ['C',s] ['C',2rs+s] => ['B',r] x ['C',s] ['C',2rs] => ['C',r] x ['D',s]. corresponding to the tensor product homomorphism. For type A, the homomorphism is GL(r) x GL(s) -> GL(rs). For the classical types, the relevant fact is that if V,W are orthogonal or symplectic spaces, that is, spaces endowed with symmetric or skew-symmetric bilinear forms, then V tensor W is also an orthogonal space (if V and W are both orthogonal or both symplectic) or symplectic (if one of V and W is orthogonal and the other symplectic). The corresponding branching rules are obtained using rule="tensor". SYMMETRIC POWER: The k-th symmetric and exterior power homomorphisms map GL(n) --> GL(binomial(n+k-1,k)) and GL(binomial(n,k)). The corresponding branching rules are not implemented but a special case is. The k-th symmetric power homomorphism SL(2) --> GL(k+1) has its image inside of SO(2r+1) if k=2r and inside of Sp(2r) if k=2r-1. Hence there are branching rules:: ['B',r] => A1 ['C',r] => A1 and these may be obtained using the rule "symmetric_power". MISCELLANEOUS: Use rule="miscellaneous" for the following rules:: B3 => G2 F4 => G2xA1 (not implemented yet) BRANCHING RULES FROM PLETHYSMS Nearly all branching rules G => H where G is of type A,B,C or D are covered by the preceding rules. The function branching_rules_from_plethysm covers the remaining cases. ISOMORPHIC TYPE: Although not usually referred to as a branching rule, the effects of the accidental isomorphisms may be handled using rule="isomorphic":: B2 => C2 C2 => B2 A3 => D3 D3 => A3 D2 => A1xA1 B1 => A1 C1 => A1 EXAMPLES: (Levi type) :: sage: A1 = WeylCharacterRing("A1") sage: A2 = WeylCharacterRing("A2") sage: A3 = WeylCharacterRing("A3") sage: A4 = WeylCharacterRing("A4") sage: A5 = WeylCharacterRing("A5") sage: B2 = WeylCharacterRing("B2") sage: B3 = WeylCharacterRing("B3") sage: B4 = WeylCharacterRing("B4") sage: C2 = WeylCharacterRing("C2") sage: C3 = WeylCharacterRing("C3") sage: D3 = WeylCharacterRing("D3") sage: D4 = WeylCharacterRing("D4") sage: D5 = WeylCharacterRing("D5") sage: G2 = WeylCharacterRing("G2") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: [B3(w).branch(A2,rule="levi") for w in B3.fundamental_weights()] [A2(0,0,-1) + A2(0,0,0) + A2(1,0,0), A2(0,-1,-1) + A2(0,0,-1) + A2(0,0,0) + A2(1,0,-1) + A2(1,0,0) + A2(1,1,0), A2(-1/2,-1/2,-1/2) + A2(1/2,-1/2,-1/2) + A2(1/2,1/2,-1/2) + A2(1/2,1/2,1/2)] The last example must be understood as follows. The representation of B3 being branched is spin, which is not a representation of SO(7) but of its double cover spin(7). The group A2 is really GL(3) and the double cover of SO(7) induces a cover of GL(3) that is trivial over SL(3) but not over the center of GL(3). The weight lattice for this GL(3) consists of triples (a,b,c) of half integers such that a-b and b-c are in `\ZZ`, and this is reflected in the last decomposition. :: sage: [C3(w).branch(A2,rule="levi") for w in C3.fundamental_weights()] [A2(0,0,-1) + A2(1,0,0), A2(0,-1,-1) + A2(1,0,-1) + A2(1,1,0), A2(-1,-1,-1) + A2(1,-1,-1) + A2(1,1,-1) + A2(1,1,1)] sage: [D4(w).branch(A3,rule="levi") for w in D4.fundamental_weights()] [A3(0,0,0,-1) + A3(1,0,0,0), A3(0,0,-1,-1) + A3(0,0,0,0) + A3(1,0,0,-1) + A3(1,1,0,0), A3(1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,-1/2), A3(-1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,1/2)] sage: [B3(w).branch(B2,rule="levi") for w in B3.fundamental_weights()] [2*B2(0,0) + B2(1,0), B2(0,0) + 2*B2(1,0) + B2(1,1), 2*B2(1/2,1/2)] sage: C3 = WeylCharacterRing(['C',3]) sage: [C3(w).branch(C2,rule="levi") for w in C3.fundamental_weights()] [2*C2(0,0) + C2(1,0), C2(0,0) + 2*C2(1,0) + C2(1,1), C2(1,0) + 2*C2(1,1)] sage: [D5(w).branch(D4,rule="levi") for w in D5.fundamental_weights()] [2*D4(0,0,0,0) + D4(1,0,0,0), D4(0,0,0,0) + 2*D4(1,0,0,0) + D4(1,1,0,0), D4(1,0,0,0) + 2*D4(1,1,0,0) + D4(1,1,1,0), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2)] sage: G2(1,0,-1).branch(A1,rule="levi") A1(0,-1) + A1(1,-1) + A1(1,0) sage: E6=WeylCharacterRing("E6",style="coroots") sage: D5=WeylCharacterRing("D5",style="coroots") sage: fw = E6.fundamental_weights() sage: [E6(fw[i]).branch(D5,rule="levi") for i in [1,2,6]] # long time (3s) [D5(0,0,0,0,0) + D5(0,0,0,0,1) + D5(1,0,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(0,0,0,0,1) + D5(0,1,0,0,0), D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(1,0,0,0,0)] sage: E7=WeylCharacterRing("E7",style="coroots") sage: D6=WeylCharacterRing("D6",style="coroots") sage: fw = E7.fundamental_weights() sage: [E7(fw[i]).branch(D6,rule="levi") for i in [1,2,7]] # long time (26s) [3*D6(0,0,0,0,0,0) + 2*D6(0,0,0,0,1,0) + D6(0,1,0,0,0,0), 3*D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0) + 2*D6(0,0,1,0,0,0) + D6(1,0,0,0,1,0), D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0)] sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8=WeylCharacterRing("E8",style="coroots",cache=True) sage: D7=WeylCharacterRing("D7",style="coroots",cache=True) sage: E8(1,0,0,0,0,0,0,0).branch(D7,rule="levi") # not tested (very long time) (160s) 3*D7(0,0,0,0,0,0,0) + 2*D7(0,0,0,0,0,1,0) + 2*D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) + 2*D7(0,0,1,0,0,0,0) + D7(0,0,0,1,0,0,0) + D7(1,0,0,0,0,1,0) + D7(1,0,0,0,0,0,1) + D7(2,0,0,0,0,0,0) sage: E8(0,0,0,0,0,0,0,1).branch(D7,rule="levi") # long time (3s) D7(0,0,0,0,0,0,0) + D7(0,0,0,0,0,1,0) + D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0) sage: [F4(fw).branch(B3,rule="levi") for fw in F4.fundamental_weights()] # long time (36s) [B3(0,0,0) + 2*B3(1/2,1/2,1/2) + 2*B3(1,0,0) + B3(1,1,0), B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 5*B3(1,0,0) + 7*B3(1,1,0) + 3*B3(1,1,1) + 6*B3(3/2,1/2,1/2) + 2*B3(3/2,3/2,1/2) + B3(2,0,0) + 2*B3(2,1,0) + B3(2,1,1), 3*B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 4*B3(1,0,0) + 3*B3(1,1,0) + B3(1,1,1) + 2*B3(3/2,1/2,1/2), 3*B3(0,0,0) + 2*B3(1/2,1/2,1/2) + B3(1,0,0)] sage: [F4(fw).branch(C3,rule="levi") for fw in F4.fundamental_weights()] # long time (6s) [3*C3(0,0,0) + 2*C3(1,1,1) + C3(2,0,0), 3*C3(0,0,0) + 6*C3(1,1,1) + 4*C3(2,0,0) + 2*C3(2,1,0) + 3*C3(2,2,0) + C3(2,2,2) + C3(3,1,0) + 2*C3(3,1,1), 2*C3(1,0,0) + 3*C3(1,1,0) + C3(2,0,0) + 2*C3(2,1,0) + C3(2,1,1), 2*C3(1,0,0) + C3(1,1,0)] sage: A1xA1 = WeylCharacterRing("A1xA1") sage: [A3(hwv).branch(A1xA1,rule="levi") for hwv in A3.fundamental_weights()] [A1xA1(0,0,1,0) + A1xA1(1,0,0,0), A1xA1(0,0,1,1) + A1xA1(1,0,1,0) + A1xA1(1,1,0,0), A1xA1(1,0,1,1) + A1xA1(1,1,1,0)] sage: A1xB1=WeylCharacterRing("A1xB1",style="coroots") sage: [B3(x).branch(A1xB1,rule="levi") for x in B3.fundamental_weights()] [A1xB1(0,2) + 2*A1xB1(1,0), 3*A1xB1(0,0) + A1xB1(0,2) + 2*A1xB1(1,2) + A1xB1(2,0), 2*A1xB1(0,1) + A1xB1(1,1)] EXAMPLES: (Automorphic type, including D4 triality) :: sage: [A3(chi).branch(A3,rule="automorphic") for chi in A3.fundamental_weights()] [A3(0,0,0,-1), A3(0,0,-1,-1), A3(0,-1,-1,-1)] sage: [D4(chi).branch(D4,rule="automorphic") for chi in D4.fundamental_weights()] [D4(1,0,0,0), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2)] sage: [D4(chi).branch(D4,rule="triality") for chi in D4.fundamental_weights()] [D4(1/2,1/2,1/2,-1/2), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1,0,0,0)] EXAMPLES: (Symmetric type) :: sage: [w.branch(B2,rule="symmetric") for w in [A4(1,0,0,0,0),A4(1,1,0,0,0),A4(1,1,1,0,0),A4(2,0,0,0,0)]] [B2(1,0), B2(1,1), B2(1,1), B2(0,0) + B2(2,0)] sage: [A5(w).branch(C3,rule="symmetric") for w in A5.fundamental_weights()] [C3(1,0,0), C3(0,0,0) + C3(1,1,0), C3(1,0,0) + C3(1,1,1), C3(0,0,0) + C3(1,1,0), C3(1,0,0)] sage: [A5(w).branch(D3,rule="symmetric") for w in A5.fundamental_weights()] [D3(1,0,0), D3(1,1,0), D3(1,1,-1) + D3(1,1,1), D3(1,1,0), D3(1,0,0)] sage: [D4(x).branch(B3,rule="symmetric") for x in D4.fundamental_weights()] [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(1,1,0), B3(1/2,1/2,1/2), B3(1/2,1/2,1/2)] sage: [D4(x).branch(G2,rule="symmetric") for x in D4.fundamental_weights()] [G2(0,0,0) + G2(1,0,-1), 2*G2(1,0,-1) + G2(2,-1,-1), G2(0,0,0) + G2(1,0,-1), G2(0,0,0) + G2(1,0,-1)] sage: [E6(fw).branch(F4,rule="symmetric") for fw in E6.fundamental_weights()] # long time (36s) [F4(0,0,0,0) + F4(0,0,0,1), F4(0,0,0,1) + F4(1,0,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(1,0,0,0) + 2*F4(0,0,1,0) + F4(1,0,0,1) + F4(0,1,0,0), F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0), F4(0,0,0,0) + F4(0,0,0,1)] EXAMPLES: (Extended type) :: sage: [B3(x).branch(D3,rule="extended") for x in B3.fundamental_weights()] [D3(0,0,0) + D3(1,0,0), D3(1,0,0) + D3(1,1,0), D3(1/2,1/2,-1/2) + D3(1/2,1/2,1/2)] sage: [G2(w).branch(A2, rule="extended") for w in G2.fundamental_weights()] [A2(0,0,0) + A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3), A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3) + A2(1,0,-1)] sage: [F4(fw).branch(B4,rule="extended") for fw in F4.fundamental_weights()] # long time (9s) [B4(1/2,1/2,1/2,1/2) + B4(1,1,0,0), B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2) + B4(3/2,3/2,1/2,1/2) + B4(2,1,1,0), B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0) + B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2), B4(0,0,0,0) + B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0)] sage: E6 = WeylCharacterRing("E6", style="coroots") sage: A2xA2xA2=WeylCharacterRing("A2xA2xA2",style="coroots") sage: A5xA1=WeylCharacterRing("A5xA1",style="coroots") sage: G2 = WeylCharacterRing("G2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: F4 = WeylCharacterRing("F4",style="coroots") sage: A3xA1 = WeylCharacterRing("A3xA1", style="coroots") sage: A2xA2 = WeylCharacterRing("A2xA2", style="coroots") sage: A1xC3 = WeylCharacterRing("A1xC3",style="coroots") sage: E6(1,0,0,0,0,0).branch(A5xA1,rule="extended") # (0.7s) A5xA1(0,0,0,1,0,0) + A5xA1(1,0,0,0,0,1) sage: E6(1,0,0,0,0,0).branch(A2xA2xA2, rule="extended") # (0.7s) A2xA2xA2(0,0,0,1,1,0) + A2xA2xA2(0,1,1,0,0,0) + A2xA2xA2(1,0,0,0,0,1) sage: E7=WeylCharacterRing("E7",style="coroots") sage: A7=WeylCharacterRing("A7",style="coroots") sage: E7(1,0,0,0,0,0,0).branch(A7,rule="extended") # long time (5s) A7(0,0,0,1,0,0,0) + A7(1,0,0,0,0,0,1) sage: E8=WeylCharacterRing("E8",cache=true,style="coroots") sage: D8=WeylCharacterRing("D8",cache=true,style="coroots") sage: E8(0,0,0,0,0,0,0,1).branch(D8,rule="extended") # long time (19s) D8(0,0,0,0,0,0,1,0) + D8(0,1,0,0,0,0,0,0) sage: F4(1,0,0,0).branch(A1xC3,rule="extended") # (0.7s) A1xC3(0,2,0,0) + A1xC3(1,0,0,1) + A1xC3(2,0,0,0) sage: G2(0,1).branch(A1xA1, rule="extended") A1xA1(0,2) + A1xA1(2,0) + A1xA1(3,1) sage: F4(0,0,0,1).branch(A2xA2, rule="extended") # (0.4s) A2xA2(0,0,1,1) + A2xA2(0,1,0,1) + A2xA2(1,0,1,0) sage: F4(0,0,0,1).branch(A3xA1,rule="extended") # (0.34s) A3xA1(0,0,0,0) + A3xA1(0,0,0,2) + A3xA1(0,0,1,1) + A3xA1(0,1,0,0) + A3xA1(1,0,0,1) sage: D4=WeylCharacterRing("D4",style="coroots") sage: D2xD2=WeylCharacterRing("D2xD2",style="coroots") # We get D4 => A1xA1xA1xA1 by remembering that A1xA1 = D2. sage: [D4(fw).branch(D2xD2, rule="extended") for fw in D4.fundamental_weights()] [D2xD2(0,0,1,1) + D2xD2(1,1,0,0), D2xD2(0,0,2,0) + D2xD2(0,0,0,2) + D2xD2(2,0,0,0) + D2xD2(1,1,1,1) + D2xD2(0,2,0,0), D2xD2(1,0,0,1) + D2xD2(0,1,1,0), D2xD2(1,0,1,0) + D2xD2(0,1,0,1)] EXAMPLES: (Tensor type) :: sage: A5=WeylCharacterRing("A5", style="coroots") sage: A2xA1=WeylCharacterRing("A2xA1", style="coroots") sage: [A5(hwv).branch(A2xA1, rule="tensor") for hwv in A5.fundamental_weights()] [A2xA1(1,0,1), A2xA1(0,1,2) + A2xA1(2,0,0), A2xA1(0,0,3) + A2xA1(1,1,1), A2xA1(1,0,2) + A2xA1(0,2,0), A2xA1(0,1,1)] sage: B4=WeylCharacterRing("B4",style="coroots") sage: B1xB1=WeylCharacterRing("B1xB1",style="coroots") sage: [B4(f).branch(B1xB1,rule="tensor") for f in B4.fundamental_weights()] [B1xB1(2,2), B1xB1(0,2) + B1xB1(2,0) + B1xB1(2,4) + B1xB1(4,2), B1xB1(0,2) + B1xB1(0,6) + B1xB1(2,0) + B1xB1(2,2) + B1xB1(2,4) + B1xB1(4,2) + B1xB1(4,4) + B1xB1(6,0), B1xB1(1,3) + B1xB1(3,1)] sage: D4=WeylCharacterRing("D4",style="coroots") sage: C2xC1=WeylCharacterRing("C2xC1",style="coroots") sage: [D4(f).branch(C2xC1,rule="tensor") for f in D4.fundamental_weights()] [C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,2) + C2xC1(2,0,0), C2xC1(1,0,1), C2xC1(0,0,2) + C2xC1(0,1,0)] sage: C3=WeylCharacterRing("C3",style="coroots") sage: B1xC1=WeylCharacterRing("B1xC1",style="coroots") sage: [C3(f).branch(B1xC1,rule="tensor") for f in C3.fundamental_weights()] [B1xC1(2,1), B1xC1(2,2) + B1xC1(4,0), B1xC1(0,3) + B1xC1(4,1)] EXAMPLES: (Symmetric Power) :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: B3=WeylCharacterRing("B3",style="coroots") sage: C3=WeylCharacterRing("C3",style="coroots") sage: [B3(fw).branch(A1,rule="symmetric_power") for fw in B3.fundamental_weights()] [A1(6), A1(2) + A1(6) + A1(10), A1(0) + A1(6)] sage: [C3(fw).branch(A1,rule="symmetric_power") for fw in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] EXAMPLES: (Miscellaneous type) :: sage: G2 = WeylCharacterRing("G2") sage: [fw1, fw2, fw3] = B3.fundamental_weights() sage: B3(fw1+fw3).branch(G2, rule="miscellaneous") G2(1,0,-1) + G2(2,-1,-1) + G2(2,0,-2) EXAMPLES: (Isomorphic type) :: sage: [B2(x).branch(C2, rule="isomorphic") for x in B2.fundamental_weights()] [C2(1,1), C2(1,0)] sage: [C2(x).branch(B2, rule="isomorphic") for x in C2.fundamental_weights()] [B2(1/2,1/2), B2(1,0)] sage: [A3(x).branch(D3,rule="isomorphic") for x in A3.fundamental_weights()] [D3(1/2,1/2,1/2), D3(1,0,0), D3(1/2,1/2,-1/2)] sage: [D3(x).branch(A3,rule="isomorphic") for x in D3.fundamental_weights()] [A3(1/2,1/2,-1/2,-1/2), A3(1/4,1/4,1/4,-3/4), A3(3/4,-1/4,-1/4,-1/4)] Here A3(x,y,z,w) can be understood as a representation of SL(4). The weights x,y,z,w and x+t,y+t,z+t,w+t represent the same representation of SL(4) - though not of GL(4) - since A3(x+t,y+t,z+t,w+t) is the same as A3(x,y,z,w) tensored with `det^t`. So as a representation of SL(4), A3(1/4,1/4,1/4,-3/4) is the same as A3(1,1,1,0). The exterior square representation SL(4) -> GL(6) admits an invariant symmetric bilinear form, so is a representation SL(4) -> SO(6) that lifts to an isomorphism SL(4) -> Spin(6). Conversely, there are two isomorphisms SO(6) -> SL(4), of which we've selected one. In cases like this you might prefer style="coroots". :: sage: A3 = WeylCharacterRing("A3",style="coroots") sage: D3 = WeylCharacterRing("D3",style="coroots") sage: [D3(fw) for fw in D3.fundamental_weights()] [D3(1,0,0), D3(0,1,0), D3(0,0,1)] sage: [D3(fw).branch(A3,rule="isomorphic") for fw in D3.fundamental_weights()] [A3(0,1,0), A3(0,0,1), A3(1,0,0)] sage: D2 = WeylCharacterRing("D2", style="coroots") sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots") sage: [D2(fw).branch(A1xA1,rule="isomorphic") for fw in D2.fundamental_weights()] [A1xA1(1,0), A1xA1(0,1)] EXAMPLES: (Branching rules from plethysms) This is a general rule that includes any branching rule from types A,B,C or D as a special case. Thus it could be used in place of the above rules and would give the same results. However it is most useful when branching from G to a maximal subgroup H such that rank(H) < rank(G)-1. We consider a homomorphism H --> G where G is one of SL(r+1), SO(2r+1), Sp(2r) or SO(2r). The function branching_rule_from_plethysm produces the corresponding branching rule. The main ingredient is the character chi of the representation of H that is the homomorphism to GL(r+1), GL(2r+1) or GL(2r). This rule is so powerful that it contains the other rules implemented above as special cases. First let us consider the symmetric fifth power representation of SL(2). :: sage: A1=WeylCharacterRing("A1",style="coroots") sage: chi=A1([5]) sage: chi.degree() 6 sage: chi.frobenius_schur_indicator() -1 This confirms that the character has degree 6 and is symplectic, so it corresponds to a homomorphism SL(2) --> Sp(6), and there is a corresponding branching rule C3 => A1. :: sage: C3 = WeylCharacterRing("C3",style="coroots") sage: sym5rule = branching_rule_from_plethysm(chi,"C3") sage: [C3(hwv).branch(A1,rule=sym5rule) for hwv in C3.fundamental_weights()] [A1(5), A1(4) + A1(8), A1(3) + A1(9)] This is identical to the results we would obtain using rule="symmetric_power". The next example gives a branching not available by other standard rules. :: sage: G2 = WeylCharacterRing("G2",style="coroots") sage: D7 = WeylCharacterRing("D7",style="coroots") sage: ad=G2(0,1); ad.degree(); ad.frobenius_schur_indicator() 14 1 sage: spin = D7(0,0,0,0,0,1,0); spin.degree() 64 sage: spin.branch(G2, rule=branching_rule_from_plethysm(ad, "D7")) G2(1,1) We have confirmed that the adjoint representation of G2 gives a homomorphism into SO(14), and that the pullback of the one of the two 64 dimensional spin representations to SO(14) is an irreducible representation of G2. BRANCHING FROM A REDUCIBLE ROOT SYSTEM If you are branching from a reducible root system, the rule is a list of rules, one for each component type in the root system. The rules in the list are given in pairs [type, rule], where type is the root system to be branched to, and rule is the branching rule. :: sage: D4 = WeylCharacterRing("D4",style="coroots") sage: D2xD2 = WeylCharacterRing("D2xD2",style="coroots") sage: A1xA1xA1xA1 = WeylCharacterRing("A1xA1xA1xA1",style="coroots") sage: rr = [["A1xA1","isomorphic"],["A1xA1","isomorphic"]] sage: [D4(fw) for fw in D4.fundamental_weights()] [D4(1,0,0,0), D4(0,1,0,0), D4(0,0,1,0), D4(0,0,0,1)] sage: [D4(fw).branch(D2xD2,rule="extended").branch(A1xA1xA1xA1,rule=rr) for fw in D4.fundamental_weights()] [A1xA1xA1xA1(0,0,1,1) + A1xA1xA1xA1(1,1,0,0), A1xA1xA1xA1(0,0,0,2) + A1xA1xA1xA1(0,0,2,0) + A1xA1xA1xA1(0,2,0,0) + A1xA1xA1xA1(1,1,1,1) + A1xA1xA1xA1(2,0,0,0), A1xA1xA1xA1(0,1,1,0) + A1xA1xA1xA1(1,0,0,1), A1xA1xA1xA1(0,1,0,1) + A1xA1xA1xA1(1,0,1,0)] WRITING YOUR OWN RULES Suppose you want to branch from a group G to a subgroup H. Arrange the embedding so that a Cartan subalgebra U of H is contained in a Cartan subalgebra T of G. There is thus a mapping from the weight spaces Lie(T)* --> Lie(U)*. Two embeddings will produce identical branching rules if they differ by an element of the Weyl group of H. The RULE is this map Lie(T)* = G.space() to Lie(U)* = H.space(), which you may implement as a function. As an example, let us consider how to implement the branching rule A3 => C2. Here H = C2 = Sp(4) embedded as a subgroup in A3 = GL(4). The Cartan subalgebra U consists of diagonal matrices with eigenvalues u1, u2, -u2, -u1. The C2.space() is the two dimensional vector spaces consisting of the linear functionals u1 and u2 on U. On the other hand Lie(T) is RR^4. A convenient way to see the restriction is to think of it as the adjoint of the map [u1,u2] -> [u1,u2,-u2,-u1], that is, [x0,x1,x2,x3] -> [x0-x3,x1-x2]. Hence we may encode the rule: :: def rule(x): return [x[0]-x[3],x[1]-x[2]] or simply: :: rule = lambda x : [x[0]-x[3],x[1]-x[2]] EXAMPLES:: sage: A3 = WeylCharacterRing(['A',3]) sage: C2 = WeylCharacterRing(['C',2]) sage: rule = lambda x : [x[0]-x[3],x[1]-x[2]] sage: branch_weyl_character(A3([1,1,0,0]),A3,C2,rule) C2(0,0) + C2(1,1) sage: A3(1,1,0,0).branch(C2, rule) == C2(0,0) + C2(1,1) True """ if type(rule) == str: rule = get_branching_rule(R._cartan_type, S._cartan_type, rule) elif R._cartan_type.is_compound(): Rtypes = R._cartan_type.component_types() Stypes = [CartanType(l[0]) for l in rule] rules = [l[1] for l in rule] ntypes = len(Rtypes) rule_list = [get_branching_rule(Rtypes[i], Stypes[i], rules[i]) for i in range(ntypes)] shifts = R._cartan_type._shifts def rule(x): yl = [] for i in range(ntypes): yl.append(rule_list[i](x[shifts[i]:shifts[i+1]])) return flatten(yl) mdict = {} for k in chi._mdict: if S._style == "coroots": if S._cartan_type.is_atomic() and S._cartan_type[0] == 'E': if S._cartan_type[1] == 6: h = S._space(rule(list(k.to_vector()))) h = S.coerce_to_e6(h) elif S._cartan_type[1] == 7: h = S.coerce_to_e7(S._space(rule(list(k.to_vector())))) else: h = S.coerce_to_sl(S._space(rule(list(k.to_vector())))) else: h = S._space(rule(list(k.to_vector()))) if h in mdict: mdict[h] += chi._mdict[k] else: mdict[h] = chi._mdict[k] hdict = S.char_from_weights(mdict) return WeylCharacter(S, hdict, mdict)
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
elif rule == "extended": if not s == r:
elif rule == "extended" or rule == "orthogonal_sum": if rule == "extended" and not s == r:
def rule(x) : x[len(x)-1] = -x[len(x)-1]; return x
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
if x == 0:
if x == 0 and not x in self._space:
def __call__(self, *args): """ Coerces the element into the ring.
1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1eccddf4fcbebe14ce1d16293707d2b8b0ee94b8/weyl_characters.py
K = self.base_ring()._magma_init_(magma)
K = magma(self.base_ring())
def _magma_init_(self, magma): r""" EXAMPLES: We first coerce a square matrix.
4371b59167340f70b3a65399fef9b6c7900996cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4371b59167340f70b3a65399fef9b6c7900996cd/matrix_space.py
s = 'MatrixAlgebra(%s,%s)'%(K, self.__nrows)
s = 'MatrixAlgebra(%s,%s)'%(K.name(), self.__nrows)
def _magma_init_(self, magma): r""" EXAMPLES: We first coerce a square matrix.
4371b59167340f70b3a65399fef9b6c7900996cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4371b59167340f70b3a65399fef9b6c7900996cd/matrix_space.py
s = 'RMatrixSpace(%s,%s,%s)'%(K, self.__nrows, self.__ncols)
s = 'RMatrixSpace(%s,%s,%s)'%(K.name(), self.__nrows, self.__ncols)
def _magma_init_(self, magma): r""" EXAMPLES: We first coerce a square matrix.
4371b59167340f70b3a65399fef9b6c7900996cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4371b59167340f70b3a65399fef9b6c7900996cd/matrix_space.py
A stochastic matrix is a matrix such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ).
A stochastic matrix is a matrix with nonnegative real entries such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ).
def bistochastic_as_sum_of_permutations(M, check = True): r""" Returns the positive sum of permutations corresponding to the bistochastic matrix. A stochastic matrix is a matrix such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ). According to the Birkhoff-von Neumann Theorem, any bistochastic matrix can be written as a positive sum of permutation matrices, which also means that the polytope of bistochastic matrices is integer. As a non-bistochastic matrix can obviously not be written as a sum of permutations, this theorem is an equivalence. This function, given a bistochastic matrix, returns the corresponding decomposition. INPUT: - ``M`` -- A bistochastic matrix - ``check`` (boolean) -- set to ``True`` (default) to checl that the matrix is indeed bistochastic OUTPUT: - An element of ``CombinatorialFreeModule``, which is a free `F`-module ( where `F` is the ground ring of the given matrix ) whose basis is indexed by the permutations. .. NOTE:: - In this function, we just assume 1 to be any constant : for us a matrix M is bistochastic if there exists `c>0` such that `M/c` is bistochastic. - You can obtain a sequence of pairs ``(permutation,coeff)``, where ``permutation` is a Sage ``Permutation`` instance, and ``coeff`` its corresponding coefficient from the result of this function by applying the ``list`` function. - If you are interested in the matrix corresponding to a ``Permutation`` you will be glad to learn about the ``Permutation.to_matrix()`` method. - The base ring of the matrix can be anything that can be coerced to ``RR``. .. SEEALSO: - :meth:`as_sum_of_permutations <sage.matrix.matrix2.as_sum_of_permutations>` -- to use this method through the ``Matrix`` class. EXAMPLE: We create a bistochastic matrix from a convex sum of permutations, then try to deduce the decomposition from the matrix :: sage: from sage.combinat.permutation import bistochastic_as_sum_of_permutations sage: L = [] sage: L.append((9,Permutation([4, 1, 3, 5, 2]))) sage: L.append((6,Permutation([5, 3, 4, 1, 2]))) sage: L.append((3,Permutation([3, 1, 4, 2, 5]))) sage: L.append((2,Permutation([1, 4, 2, 3, 5]))) sage: M = sum([c * p.to_matrix() for (c,p) in L]) sage: decomp = bistochastic_as_sum_of_permutations(M) sage: print decomp 2*B[[1, 4, 2, 3, 5]] + 3*B[[3, 1, 4, 2, 5]] + 9*B[[4, 1, 3, 5, 2]] + 6*B[[5, 3, 4, 1, 2]] An exception is raised when the matrix is not bistochastic:: sage: M = Matrix([[2,3],[2,2]]) sage: decomp = bistochastic_as_sum_of_permutations(M) Traceback (most recent call last): ... ValueError: The matrix is not bistochastic """ from sage.graphs.bipartite_graph import BipartiteGraph from sage.combinat.free_module import CombinatorialFreeModule from sage.rings.real_mpfr import RR n=M.nrows() if n != M.ncols(): raise ValueError("The matrix is expected to be square") if check and not M.is_bistochastic(normalized = False): raise ValueError("The matrix is not bistochastic") if not RR.has_coerce_map_from(M.base_ring()): raise ValueError("The base ring of the matrix must have a coercion map to RR") CFM=CombinatorialFreeModule(M.base_ring(),Permutations(n)) value=0 G = BipartiteGraph(M,weighted=True) while G.size() > 0: matching = G.matching(use_edge_labels=True) # This minimum is strictly larger than 0 minimum = min([x[2] for x in matching]) for (u,v,l) in matching: if minimum == l: G.delete_edge((u,v,l)) else: G.set_edge_label(u,v,l-minimum) matching.sort(key=lambda x: x[0]) value+=minimum*CFM(Permutation([x[1]-n+1 for x in matching])) return value
3d841b41396ffdcc7218e64fcbb4650c74bb529b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3d841b41396ffdcc7218e64fcbb4650c74bb529b/permutation.py
- ``check`` (boolean) -- set to ``True`` (default) to checl
- ``check`` (boolean) -- set to ``True`` (default) to check
def bistochastic_as_sum_of_permutations(M, check = True): r""" Returns the positive sum of permutations corresponding to the bistochastic matrix. A stochastic matrix is a matrix such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ). According to the Birkhoff-von Neumann Theorem, any bistochastic matrix can be written as a positive sum of permutation matrices, which also means that the polytope of bistochastic matrices is integer. As a non-bistochastic matrix can obviously not be written as a sum of permutations, this theorem is an equivalence. This function, given a bistochastic matrix, returns the corresponding decomposition. INPUT: - ``M`` -- A bistochastic matrix - ``check`` (boolean) -- set to ``True`` (default) to checl that the matrix is indeed bistochastic OUTPUT: - An element of ``CombinatorialFreeModule``, which is a free `F`-module ( where `F` is the ground ring of the given matrix ) whose basis is indexed by the permutations. .. NOTE:: - In this function, we just assume 1 to be any constant : for us a matrix M is bistochastic if there exists `c>0` such that `M/c` is bistochastic. - You can obtain a sequence of pairs ``(permutation,coeff)``, where ``permutation` is a Sage ``Permutation`` instance, and ``coeff`` its corresponding coefficient from the result of this function by applying the ``list`` function. - If you are interested in the matrix corresponding to a ``Permutation`` you will be glad to learn about the ``Permutation.to_matrix()`` method. - The base ring of the matrix can be anything that can be coerced to ``RR``. .. SEEALSO: - :meth:`as_sum_of_permutations <sage.matrix.matrix2.as_sum_of_permutations>` -- to use this method through the ``Matrix`` class. EXAMPLE: We create a bistochastic matrix from a convex sum of permutations, then try to deduce the decomposition from the matrix :: sage: from sage.combinat.permutation import bistochastic_as_sum_of_permutations sage: L = [] sage: L.append((9,Permutation([4, 1, 3, 5, 2]))) sage: L.append((6,Permutation([5, 3, 4, 1, 2]))) sage: L.append((3,Permutation([3, 1, 4, 2, 5]))) sage: L.append((2,Permutation([1, 4, 2, 3, 5]))) sage: M = sum([c * p.to_matrix() for (c,p) in L]) sage: decomp = bistochastic_as_sum_of_permutations(M) sage: print decomp 2*B[[1, 4, 2, 3, 5]] + 3*B[[3, 1, 4, 2, 5]] + 9*B[[4, 1, 3, 5, 2]] + 6*B[[5, 3, 4, 1, 2]] An exception is raised when the matrix is not bistochastic:: sage: M = Matrix([[2,3],[2,2]]) sage: decomp = bistochastic_as_sum_of_permutations(M) Traceback (most recent call last): ... ValueError: The matrix is not bistochastic """ from sage.graphs.bipartite_graph import BipartiteGraph from sage.combinat.free_module import CombinatorialFreeModule from sage.rings.real_mpfr import RR n=M.nrows() if n != M.ncols(): raise ValueError("The matrix is expected to be square") if check and not M.is_bistochastic(normalized = False): raise ValueError("The matrix is not bistochastic") if not RR.has_coerce_map_from(M.base_ring()): raise ValueError("The base ring of the matrix must have a coercion map to RR") CFM=CombinatorialFreeModule(M.base_ring(),Permutations(n)) value=0 G = BipartiteGraph(M,weighted=True) while G.size() > 0: matching = G.matching(use_edge_labels=True) # This minimum is strictly larger than 0 minimum = min([x[2] for x in matching]) for (u,v,l) in matching: if minimum == l: G.delete_edge((u,v,l)) else: G.set_edge_label(u,v,l-minimum) matching.sort(key=lambda x: x[0]) value+=minimum*CFM(Permutation([x[1]-n+1 for x in matching])) return value
3d841b41396ffdcc7218e64fcbb4650c74bb529b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3d841b41396ffdcc7218e64fcbb4650c74bb529b/permutation.py
An exception is raised when the matrix is not bistochastic::
An exception is raised when the matrix is not positive and bistochastic::
def bistochastic_as_sum_of_permutations(M, check = True): r""" Returns the positive sum of permutations corresponding to the bistochastic matrix. A stochastic matrix is a matrix such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ). According to the Birkhoff-von Neumann Theorem, any bistochastic matrix can be written as a positive sum of permutation matrices, which also means that the polytope of bistochastic matrices is integer. As a non-bistochastic matrix can obviously not be written as a sum of permutations, this theorem is an equivalence. This function, given a bistochastic matrix, returns the corresponding decomposition. INPUT: - ``M`` -- A bistochastic matrix - ``check`` (boolean) -- set to ``True`` (default) to checl that the matrix is indeed bistochastic OUTPUT: - An element of ``CombinatorialFreeModule``, which is a free `F`-module ( where `F` is the ground ring of the given matrix ) whose basis is indexed by the permutations. .. NOTE:: - In this function, we just assume 1 to be any constant : for us a matrix M is bistochastic if there exists `c>0` such that `M/c` is bistochastic. - You can obtain a sequence of pairs ``(permutation,coeff)``, where ``permutation` is a Sage ``Permutation`` instance, and ``coeff`` its corresponding coefficient from the result of this function by applying the ``list`` function. - If you are interested in the matrix corresponding to a ``Permutation`` you will be glad to learn about the ``Permutation.to_matrix()`` method. - The base ring of the matrix can be anything that can be coerced to ``RR``. .. SEEALSO: - :meth:`as_sum_of_permutations <sage.matrix.matrix2.as_sum_of_permutations>` -- to use this method through the ``Matrix`` class. EXAMPLE: We create a bistochastic matrix from a convex sum of permutations, then try to deduce the decomposition from the matrix :: sage: from sage.combinat.permutation import bistochastic_as_sum_of_permutations sage: L = [] sage: L.append((9,Permutation([4, 1, 3, 5, 2]))) sage: L.append((6,Permutation([5, 3, 4, 1, 2]))) sage: L.append((3,Permutation([3, 1, 4, 2, 5]))) sage: L.append((2,Permutation([1, 4, 2, 3, 5]))) sage: M = sum([c * p.to_matrix() for (c,p) in L]) sage: decomp = bistochastic_as_sum_of_permutations(M) sage: print decomp 2*B[[1, 4, 2, 3, 5]] + 3*B[[3, 1, 4, 2, 5]] + 9*B[[4, 1, 3, 5, 2]] + 6*B[[5, 3, 4, 1, 2]] An exception is raised when the matrix is not bistochastic:: sage: M = Matrix([[2,3],[2,2]]) sage: decomp = bistochastic_as_sum_of_permutations(M) Traceback (most recent call last): ... ValueError: The matrix is not bistochastic """ from sage.graphs.bipartite_graph import BipartiteGraph from sage.combinat.free_module import CombinatorialFreeModule from sage.rings.real_mpfr import RR n=M.nrows() if n != M.ncols(): raise ValueError("The matrix is expected to be square") if check and not M.is_bistochastic(normalized = False): raise ValueError("The matrix is not bistochastic") if not RR.has_coerce_map_from(M.base_ring()): raise ValueError("The base ring of the matrix must have a coercion map to RR") CFM=CombinatorialFreeModule(M.base_ring(),Permutations(n)) value=0 G = BipartiteGraph(M,weighted=True) while G.size() > 0: matching = G.matching(use_edge_labels=True) # This minimum is strictly larger than 0 minimum = min([x[2] for x in matching]) for (u,v,l) in matching: if minimum == l: G.delete_edge((u,v,l)) else: G.set_edge_label(u,v,l-minimum) matching.sort(key=lambda x: x[0]) value+=minimum*CFM(Permutation([x[1]-n+1 for x in matching])) return value
3d841b41396ffdcc7218e64fcbb4650c74bb529b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3d841b41396ffdcc7218e64fcbb4650c74bb529b/permutation.py
from sage.rings.real_mpfr import RR
from sage.rings.all import RR
def bistochastic_as_sum_of_permutations(M, check = True): r""" Returns the positive sum of permutations corresponding to the bistochastic matrix. A stochastic matrix is a matrix such that the sum of the elements of any row is equal to 1. A bistochastic matrix is a stochastic matrix whose transpose matrix is also stochastic ( there are conditions both on the rows and on the columns ). According to the Birkhoff-von Neumann Theorem, any bistochastic matrix can be written as a positive sum of permutation matrices, which also means that the polytope of bistochastic matrices is integer. As a non-bistochastic matrix can obviously not be written as a sum of permutations, this theorem is an equivalence. This function, given a bistochastic matrix, returns the corresponding decomposition. INPUT: - ``M`` -- A bistochastic matrix - ``check`` (boolean) -- set to ``True`` (default) to checl that the matrix is indeed bistochastic OUTPUT: - An element of ``CombinatorialFreeModule``, which is a free `F`-module ( where `F` is the ground ring of the given matrix ) whose basis is indexed by the permutations. .. NOTE:: - In this function, we just assume 1 to be any constant : for us a matrix M is bistochastic if there exists `c>0` such that `M/c` is bistochastic. - You can obtain a sequence of pairs ``(permutation,coeff)``, where ``permutation` is a Sage ``Permutation`` instance, and ``coeff`` its corresponding coefficient from the result of this function by applying the ``list`` function. - If you are interested in the matrix corresponding to a ``Permutation`` you will be glad to learn about the ``Permutation.to_matrix()`` method. - The base ring of the matrix can be anything that can be coerced to ``RR``. .. SEEALSO: - :meth:`as_sum_of_permutations <sage.matrix.matrix2.as_sum_of_permutations>` -- to use this method through the ``Matrix`` class. EXAMPLE: We create a bistochastic matrix from a convex sum of permutations, then try to deduce the decomposition from the matrix :: sage: from sage.combinat.permutation import bistochastic_as_sum_of_permutations sage: L = [] sage: L.append((9,Permutation([4, 1, 3, 5, 2]))) sage: L.append((6,Permutation([5, 3, 4, 1, 2]))) sage: L.append((3,Permutation([3, 1, 4, 2, 5]))) sage: L.append((2,Permutation([1, 4, 2, 3, 5]))) sage: M = sum([c * p.to_matrix() for (c,p) in L]) sage: decomp = bistochastic_as_sum_of_permutations(M) sage: print decomp 2*B[[1, 4, 2, 3, 5]] + 3*B[[3, 1, 4, 2, 5]] + 9*B[[4, 1, 3, 5, 2]] + 6*B[[5, 3, 4, 1, 2]] An exception is raised when the matrix is not bistochastic:: sage: M = Matrix([[2,3],[2,2]]) sage: decomp = bistochastic_as_sum_of_permutations(M) Traceback (most recent call last): ... ValueError: The matrix is not bistochastic """ from sage.graphs.bipartite_graph import BipartiteGraph from sage.combinat.free_module import CombinatorialFreeModule from sage.rings.real_mpfr import RR n=M.nrows() if n != M.ncols(): raise ValueError("The matrix is expected to be square") if check and not M.is_bistochastic(normalized = False): raise ValueError("The matrix is not bistochastic") if not RR.has_coerce_map_from(M.base_ring()): raise ValueError("The base ring of the matrix must have a coercion map to RR") CFM=CombinatorialFreeModule(M.base_ring(),Permutations(n)) value=0 G = BipartiteGraph(M,weighted=True) while G.size() > 0: matching = G.matching(use_edge_labels=True) # This minimum is strictly larger than 0 minimum = min([x[2] for x in matching]) for (u,v,l) in matching: if minimum == l: G.delete_edge((u,v,l)) else: G.set_edge_label(u,v,l-minimum) matching.sort(key=lambda x: x[0]) value+=minimum*CFM(Permutation([x[1]-n+1 for x in matching])) return value
3d841b41396ffdcc7218e64fcbb4650c74bb529b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3d841b41396ffdcc7218e64fcbb4650c74bb529b/permutation.py
depends = ["sage/libs/mwrank/wrap.h"],
depends = ["sage/libs/mwrank/wrap.h"] + [ SAGE_INC + "eclib/" + h for h in ["curve.h","egr.h","descent.h","points.h","isogs.h", "marith.h","htconst.h","interface.h"] ],
def uname_specific(name, value, alternative): if name in os.uname()[0]: return value else: return alternative
970aa08d4456e1607da4c3f1d5fd3f359c3811e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/970aa08d4456e1607da4c3f1d5fd3f359c3811e9/module_list.py
define_macros = [("NTL_ALL",None)]),
define_macros = [("NTL_ALL",None)], depends = [ SAGE_INC + "eclib/" + h for h in ["interface.h","bigrat.h","rat.h","curve.h", "moddata.h","symb.h","cusp.h","homspace.h","mat.h"] ]),
def uname_specific(name, value, alternative): if name in os.uname()[0]: return value else: return alternative
970aa08d4456e1607da4c3f1d5fd3f359c3811e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/970aa08d4456e1607da4c3f1d5fd3f359c3811e9/module_list.py
define_macros = [("NTL_ALL",None)]),
define_macros = [("NTL_ALL",None)], depends = [ SAGE_INC + "eclib/" + h for h in ["interface.h","bigrat.h","rat.h","curve.h", "moddata.h","symb.h","cusp.h","homspace.h","mat.h"] ]),
def uname_specific(name, value, alternative): if name in os.uname()[0]: return value else: return alternative
970aa08d4456e1607da4c3f1d5fd3f359c3811e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/970aa08d4456e1607da4c3f1d5fd3f359c3811e9/module_list.py
define_macros = [("NTL_ALL",None)]),
define_macros = [("NTL_ALL",None)], depends = [ SAGE_INC + "eclib/" + h for h in ["interface.h","bigrat.h","rat.h","curve.h", "moddata.h","symb.h","cusp.h","xsplit.h","method.h", "oldforms.h","homspace.h","cperiods.h","newforms.h"] ]),
def uname_specific(name, value, alternative): if name in os.uname()[0]: return value else: return alternative
970aa08d4456e1607da4c3f1d5fd3f359c3811e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/970aa08d4456e1607da4c3f1d5fd3f359c3811e9/module_list.py
the curve, then `|h(P) - \hat{h}(P)| \leq B`, where `h(P)` is
the curve, then `h(P) \le \hat{h}(P) + B`, where `h(P)` is
def CPS_height_bound(self): r""" Return the Cremona-Prickett-Siksek height bound. This is a floating point number B such that if P is a rational point on the curve, then `|h(P) - \hat{h}(P)| \leq B`, where `h(P)` is the naive logarithmic height of `P` and `\hat{h}(P)` is the canonical height.
d7035e0e7423888e50614f31ed14f097186811a5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d7035e0e7423888e50614f31ed14f097186811a5/ell_rational_field.py
- ``e`` - A Composition
- ``e`` - a composition
def LyndonWords(e=None, k=None): """ Returns the combinatorial class of Lyndon words. A Lyndon word `w` is a word that is lexicographically less than all of its rotations. Equivalently, whenever `w` is split into two non-empty substrings, `w` is lexicographically less than the right substring. INPUT: - no input at all or - ``e`` - integer, size of alphabet - ``k`` - integer, length of the words or - ``e`` - A Composition OUTPUT: A combinatorial class of Lyndon words EXAMPLES:: sage: LyndonWords() Lyndon words If e is an integer, then e specifies the length of the alphabet; k must also be specified in this case:: sage: LW = LyndonWords(3,3); LW Lyndon words from an alphabet of size 3 of length 3 sage: LW.first() word: 112 sage: LW.last() word: 233 sage: LW.random_element() word: 112 sage: LW.cardinality() 8 If e is a (weak) composition, then it returns the class of Lyndon words that have evaluation e:: sage: LyndonWords([2, 0, 1]).list() [word: 113] sage: LyndonWords([2, 0, 1, 0, 1]).list() [word: 1135, word: 1153, word: 1315] sage: LyndonWords([2, 1, 1]).list() [word: 1123, word: 1132, word: 1213] """ if e is None and k is None: return LyndonWords_class() elif isinstance(e, (int, Integer)): if e > 0: if not isinstance(k, (int, Integer)): raise TypeError, "k must be a non-negative integer" if k < 0: raise TypeError, "k must be a non-negative integer" return LyndonWords_nk(e, k) elif e in Compositions(): return LyndonWords_evaluation(e) raise TypeError, "e must be a positive integer or a composition"
e573cf391fa693431822cb4ca3180ddfee132119 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e573cf391fa693431822cb4ca3180ddfee132119/lyndon_word.py
A combinatorial class of Lyndon words
A combinatorial class of Lyndon words.
def LyndonWords(e=None, k=None): """ Returns the combinatorial class of Lyndon words. A Lyndon word `w` is a word that is lexicographically less than all of its rotations. Equivalently, whenever `w` is split into two non-empty substrings, `w` is lexicographically less than the right substring. INPUT: - no input at all or - ``e`` - integer, size of alphabet - ``k`` - integer, length of the words or - ``e`` - A Composition OUTPUT: A combinatorial class of Lyndon words EXAMPLES:: sage: LyndonWords() Lyndon words If e is an integer, then e specifies the length of the alphabet; k must also be specified in this case:: sage: LW = LyndonWords(3,3); LW Lyndon words from an alphabet of size 3 of length 3 sage: LW.first() word: 112 sage: LW.last() word: 233 sage: LW.random_element() word: 112 sage: LW.cardinality() 8 If e is a (weak) composition, then it returns the class of Lyndon words that have evaluation e:: sage: LyndonWords([2, 0, 1]).list() [word: 113] sage: LyndonWords([2, 0, 1, 0, 1]).list() [word: 1135, word: 1153, word: 1315] sage: LyndonWords([2, 1, 1]).list() [word: 1123, word: 1132, word: 1213] """ if e is None and k is None: return LyndonWords_class() elif isinstance(e, (int, Integer)): if e > 0: if not isinstance(k, (int, Integer)): raise TypeError, "k must be a non-negative integer" if k < 0: raise TypeError, "k must be a non-negative integer" return LyndonWords_nk(e, k) elif e in Compositions(): return LyndonWords_evaluation(e) raise TypeError, "e must be a positive integer or a composition"
e573cf391fa693431822cb4ca3180ddfee132119 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e573cf391fa693431822cb4ca3180ddfee132119/lyndon_word.py
verification that the input data represent a lyndon word.
verification that the input data represent a Lyndon word.
def __init__(self, data, check=True): r""" Construction of a Lyndon word.
e573cf391fa693431822cb4ca3180ddfee132119 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e573cf391fa693431822cb4ca3180ddfee132119/lyndon_word.py
a lyndon word
A Lyndon word.
def __init__(self, data, check=True): r""" Construction of a Lyndon word.
e573cf391fa693431822cb4ca3180ddfee132119 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e573cf391fa693431822cb4ca3180ddfee132119/lyndon_word.py
if not principal_flag: pi = K.uniformizer(P, 'negative') pie = pi a1 /= pie pie *= pi a2 /= pie pie *= pi a3 /= pie pie *= pi a4 /= pie pie *= pi pie *= pi a6 /= pie
if pi_neg is None: if principal_flag: pi_neg = pi else: pi_neg = K.uniformizer(P, 'negative') pi_neg2 = pi_neg*pi_neg pi_neg3 = pi_neg*pi_neg2 pi_neg4 = pi_neg*pi_neg3 pi_neg6 = pi_neg4*pi_neg2 a1 /= pi_neg a2 /= pi_neg2 a3 /= pi_neg3 a4 /= pi_neg4 a6 /= pi_neg6
def _pcubicroots(b, c, d): r""" Local function returning the number of roots of `x^3 + b*x^2 + c*x + d` modulo `P`, counting multiplicities """ return sum([rr[1] for rr in PolynomialRing(F, 'x')([d, c, b, 1]).roots()],0)
1d482bddbff1aa4c482b4265496b568c4c09440b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1d482bddbff1aa4c482b4265496b568c4c09440b/ell_local_data.py
"""
TESTS:: sage: P = PolynomialRing(QQ, 0, '') sage: P(5).univariate_polynomial() 5 """ if self.parent().ngens() == 0: if R is None: return self.base_ring()(self) else: return R(self)
def univariate_polynomial(self, R=None): """ Returns a univariate polynomial associated to this multivariate polynomial.
806c49cf37267795d7961f587f1d55bbd12e0b3e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/806c49cf37267795d7961f587f1d55bbd12e0b3e/multi_polynomial_element.py
if self == 0: raise ArithmeticError, "Prime factorization of 0 not defined." if R.ngens() == 0: base_ring = self.base_ring() if base_ring.is_field(): return Factorization([],unit=self.base_ring()(self)) else: F = base_ring(self).factor() return Factorization([(R(f),m) for f,m in F], unit=F.unit())
def factor(self, proof=True): r""" Compute the irreducible factorization of this polynomial.
806c49cf37267795d7961f587f1d55bbd12e0b3e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/806c49cf37267795d7961f587f1d55bbd12e0b3e/multi_polynomial_element.py
return 0
return ZZ(0)
def _eval_(self, x): """
5eb8f726f2685c0308d3cde210e956ae04159004 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5eb8f726f2685c0308d3cde210e956ae04159004/generalized.py
return 1
return ZZ(1)
def _eval_(self, x): """
5eb8f726f2685c0308d3cde210e956ae04159004 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5eb8f726f2685c0308d3cde210e956ae04159004/generalized.py
return -1
return ZZ(-1)
def _eval_(self, x): """
5eb8f726f2685c0308d3cde210e956ae04159004 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/5eb8f726f2685c0308d3cde210e956ae04159004/generalized.py
We can plot with this transform. Remember that the independent variable is the radius, and the dependent variables are the
We can plot with this transform. Remember that the dependent variable is the radius, and the independent variables are the
def transform(self, **kwds): """ EXAMPLE::
0bc33ed38d1e45e2565fa50f460f2482d9632f69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0bc33ed38d1e45e2565fa50f460f2482d9632f69/plot3d.py
We can plot with this transform. Remember that the independent variable is the height, and the dependent variables are the
We can plot with this transform. Remember that the dependent variable is the height, and the independent variables are the
def transform(self, radius=None, azimuth=None, inclination=None): """ A spherical coordinates transform.
0bc33ed38d1e45e2565fa50f460f2482d9632f69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0bc33ed38d1e45e2565fa50f460f2482d9632f69/plot3d.py
R = self.base_ring()[str(self.variables()[0])]
if self.is_constant(): R = self.base_ring()[self.parent().variable_names()[0]] else: R = self.base_ring()[str(self.variables()[0])]
def univariate_polynomial(self, R=None): """ Returns a univariate polynomial associated to this multivariate polynomial.
a14d745dddb1e9a5223186e1653c7d465e6c9639 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a14d745dddb1e9a5223186e1653c7d465e6c9639/multi_polynomial_element.py
This function returns the part of the fractional ideal self which is coprime to the prime ideals in the list S NOTE: This function assumes S is a list of prime ideals, it does not check this. This function will fail if S is not a list of prime ideals.
Return the part of this fractional ideal which is coprime to the prime ideals in the list ``S``. .. note:: This function assumes that `S` is a list of prime ideals, but does not check this. This function will fail if `S` is not a list of prime ideals.
def prime_to_S_part(self,S): r""" This function returns the part of the fractional ideal self which is coprime to the prime ideals in the list S
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
- "self" - fractional ideal - "S" - a list of prime ideals
- `S` - a list of prime ideals
def prime_to_S_part(self,S): r""" This function returns the part of the fractional ideal self which is coprime to the prime ideals in the list S
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
- an ideal coprime to the ideals in S EXAMPLES::
A fractional ideal coprime to the primes in `S`, whose prime factorization is that of ``self`` withe the primes in `S` removed. EXAMPLES::
def prime_to_S_part(self,S): r""" This function returns the part of the fractional ideal self which is coprime to the prime ideals in the list S
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
r''' Returns True if the ideal is an unit with respect to the list of primes S. INPUT:: - `S` - a list of prime ideals (not checked if they are indeed prime). OUTPUT:: True, if the ideal is `S`-unit. False, otherwise.
r""" Return True if this fractional ideal is a unit with respect to the list of primes ``S``. INPUT: - `S` - a list of prime ideals (not checked if they are indeed prime). .. note:: This function assumes that `S` is a list of prime ideals, but does not check this. This function will fail if `S` is not a list of prime ideals. OUTPUT: True, if the ideal is an `S`-unit: that is, if the valuations of the ideal at all primes not in `S` are zero. False, otherwise.
def is_S_unit(self,S): r''' Returns True if the ideal is an unit with respect to the
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
'''
"""
def is_S_unit(self,S): r''' Returns True if the ideal is an unit with respect to the
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
r''' Returns True if the ideal is an unit with respect to the list of primes S. INPUT:: - `S` - a list of prime ideals (not checked if they are indeed prime). OUTPUT:: True, if the ideal is `S`-integral. False, otherwise.
r""" Return True if this fractional ideal is integral with respect to the list of primes ``S``. INPUT: - `S` - a list of prime ideals (not checked if they are indeed prime). .. note:: This function assumes that `S` is a list of prime ideals, but does not check this. This function will fail if `S` is not a list of prime ideals. OUTPUT: True, if the ideal is `S`-integral: that is, if the valuations of the ideal at all primes not in `S` are non-negative. False, otherwise.
def is_S_integral(self,S): r''' Returns True if the ideal is an unit with respect to the
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
'''
"""
def is_S_integral(self,S): r''' Returns True if the ideal is an unit with respect to the
dd2f47f6f06398191d8dad0bb17d8c0e73073d7d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/dd2f47f6f06398191d8dad0bb17d8c0e73073d7d/number_field_ideal.py
sage: S == loads(dumps(S)) True
sage: TestSuite(S).run()
def __init__(self, s): """ TESTS::
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
element_class = Set_generic
def _element_constructor_(self, x): """ TESTS:: sage: S3 = Subsets(3); S3([1,2]) {1, 2} sage: S3([0,1,2]) Traceback (most recent call last): ... ValueError: [0, 1, 2] not in Subsets of {1, 2, 3} """ return Set(x) element_class = Set_object_enumerated
def unrank(self, r): """ Returns the subset of s that has rank k.
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
sage: S == loads(dumps(S)) True
sage: TestSuite(S).run()
def __init__(self, s, k): """ TESTS::
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
element_class = Set_generic
def _element_constructor_(self, x): """ TESTS:: sage: S32 = Subsets(3,2); S32([1,2]) {1, 2} sage: S32([0,1,2]) Traceback (most recent call last): ... ValueError: [0, 1, 2] not in Subsets of {1, 2, 3} of size 2 """ return Set(x) element_class = Set_object_enumerated
def unrank(self, r): """ Returns the subset of s that has rank k.
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
sage: S == loads(dumps(S)) True
sage: TestSuite(S).run()
def unrank(self, r): """ Returns the subset of s that has rank k.
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
sage: S == loads(dumps(S)) True
sage: TestSuite(S).run()
def __iter__(self): """ Iterates through the subsets of the multiset ``self._s``. Note that each subset is represented by a list of its elements rather than a set since we can have multiplicities (no multiset data structure yet in sage).
6b51027ab87b59ff42d9298c38dd0800c5b1d7a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/6b51027ab87b59ff42d9298c38dd0800c5b1d7a8/subset.py
raise ValueError, "%s is not a valid perfect matching: all elements of the list must be pairs"%p
raise ValueError, ("%s is not a valid perfect matching:\n" "all elements of the list must be pairs"%p)
def __classcall_private__(cls,p): r""" This function tries to recognize the input (it can be either a list or a tuple of pairs, or a fix-point free involution given as a list or as a permutation), constructs the parent (enumerated set of PerfectMatchings of the ground set) and calls the __init__ function to construct our object.
506975ec24f2b785477b1f0c809db5be7b8d366e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/506975ec24f2b785477b1f0c809db5be7b8d366e/perfect_matching.py