Indexed Generators

class sage.structure.indexed_generators.IndexedGenerators(indices, prefix='x', **kwds)

Bases: object

Abstract base class for parents whose elements consist of generators indexed by an arbitrary set.

Options controlling the printing of elements:

  • prefix – string, prefix used for printing elements of this module (optional, default ‘x’). With the default, a monomial indexed by ‘a’ would be printed as x['a'].
  • latex_prefix – string or None, prefix used in the

    System Message: WARNING/2 (\LaTeX)

    latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9k> and hyphenation patterns for 2 languages loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! You can’t use `\spacefactor’ in math mode. \@->\spacefactor \@m l.30 $\LaTeX $ [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 324 bytes). Transcript written on math.log.
    representation of elements (optional, default None). If this is anything except the empty string, it prints the index as a subscript. If this is None, it uses the setting for prefix, so if prefix is set to “B”, then a monomial indexed by ‘a’ would be printed as B_{a}. If this is the empty string, then don’t print monomials as subscripts: the monomial indexed by ‘a’ would be printed as a, or as [a] if latex_bracket is True.
  • bracketNone, bool, string, or list or tuple of strings (optional, default None): if None, use the value of the attribute self._repr_option_bracket, which has default value True. (self._repr_option_bracket is available for backwards compatibility. Users should set bracket instead. If bracket is set to anything except None, it overrides the value of self._repr_option_bracket.) If False, do not include brackets when printing elements: a monomial indexed by ‘a’ would be printed as B'a', and a monomial indexed by (1,2,3) would be printed as B(1,2,3). If True, use “[” and “]” as brackets. If it is one of “[”, “(”, or “{”, use it and its partner as brackets. If it is any other string, use it as both brackets. If it is a list or tuple of strings, use the first entry as the left bracket and the second entry as the right bracket.
  • latex_bracket – bool, string, or list or tuple of strings (optional, default False): if False, do not include brackets in the LaTeX representation of elements. This option is only relevant if latex_prefix is the empty string; otherwise, brackets are not used regardless. If True, use “left[” and “right]” as brackets. If this is one of “[”, “(”, “\{”, “|”, or “||”, use it and its partner, prepended with “left” and “right”, as brackets. If this is any other string, use it as both brackets. If this is a list or tuple of strings, use the first entry as the left bracket and the second entry as the right bracket.
  • scalar_mult – string to use for scalar multiplication in the print representation (optional, default “*”)
  • latex_scalar_mult – string or None (default: None), string to use for scalar multiplication in the latex representation. If None, use the empty string if scalar_mult is set to “*”, otherwise use the value of scalar_mult.
  • tensor_symbol – string or None (default: None), string to use for tensor product in the print representation. If None, use sage.categories.tensor.symbol.
  • generator_cmp – a comparison function (default: cmp), to use for sorting elements in the output of elements

Note

These print options may also be accessed and modified using the print_options() method, after the parent has been defined.

EXAMPLES:

We demonstrate a variety of the input options:

sage: from sage.structure.indexed_generators import IndexedGenerators
sage: I = IndexedGenerators(ZZ, prefix='A')
sage: I._repr_generator(2)
'A[2]'
sage: I._latex_generator(2)
'A_{2}'

sage: I = IndexedGenerators(ZZ, bracket='(')
sage: I._repr_generator(2)
'x(2)'
sage: I._latex_generator(2)
'x_{2}'

sage: I = IndexedGenerators(ZZ, prefix="", latex_bracket='(')
sage: I._repr_generator(2)
'[2]'
sage: I._latex_generator(2)
\left( 2 \right)

sage: I = IndexedGenerators(ZZ, bracket=['|', '>'])
sage: I._repr_generator(2)
'x|2>'
indices()

Return the indices of self.

EXAMPLES:

sage: F = CombinatorialFreeModule(QQ, ['a', 'b', 'c'])
sage: F.indices()
{'a', 'b', 'c'}
prefix()

Return the prefix used when displaying elements of self.

EXAMPLES:

sage: F = CombinatorialFreeModule(QQ, ['a', 'b', 'c'])
sage: F.prefix()
'B'
sage: X = SchubertPolynomialRing(QQ)
sage: X.prefix()
'X'
print_options(**kwds)

Return the current print options, or set an option.

INPUT: all of the input is optional; if present, it should be in the form of keyword pairs, such as latex_bracket='('. The allowable keywords are:

  • prefix
  • latex_prefix
  • bracket
  • latex_bracket
  • scalar_mult
  • latex_scalar_mult
  • tensor_symbol
  • generator_cmp

See the documentation for CombinatorialFreeModule for descriptions of the effects of setting each of these options.

OUTPUT: if the user provides any input, set the appropriate option(s) and return nothing. Otherwise, return the dictionary of settings for print and LaTeX representations.

EXAMPLES:

sage: F = CombinatorialFreeModule(ZZ, [1,2,3], prefix='x')
sage: F.print_options()
{...'prefix': 'x'...}
sage: F.print_options(bracket='(')
sage: F.print_options()
{...'bracket': '('...}

TESTS:

sage: sorted(F.print_options().items())
[('bracket', '('), ('generator_cmp', <built-in function cmp>),
 ('latex_bracket', False), ('latex_prefix', None),
 ('latex_scalar_mult', None), ('prefix', 'x'),
 ('scalar_mult', '*'), ('tensor_symbol', None)]
sage: F.print_options(bracket='[') # reset

Previous topic

Element Wrapper

Next topic

Global options

This Page