# Ticket #15096: trac_15096.patch

File trac_15096.patch, 145.8 KB (added by zimmerma, 8 years ago)
• ## sage/algebras/algebra.py

# HG changeset patch
# User Paul Zimmermann <zimmerma@loria.fr>
# Date 1377426076 -7200
# Node ID 97e176ab1ec9eef6c49788c3480b8635340f6873
# Parent  50e4bca6dc56b9e512897136e60dd9a5caa23133
#15096: corrupted documentation (global fix)

diff --git a/sage/algebras/algebra.py b/sage/algebras/algebra.py
 a r""" Return True if x is an Algebra EXAMPLES: EXAMPLES:: sage: from sage.algebras.algebra import is_Algebra sage: R. = FreeAlgebra(QQ,2) sage: is_Algebra(R)
• ## sage/coding/ag_code.py

diff --git a/sage/coding/ag_code.py b/sage/coding/ag_code.py
 a singular curves or if the field size is too large, etc.; when this happens a ??? exception is raised. EXAMPLES: EXAMPLES:: sage: x,y,z = ProjectiveSpace(2, GF(17), names = 'xyz').gens() sage: C   = Curve(y^2*z^7 - x^9 - x*z^8) sage: pts = C.rational_points(sorted=False)
• ## sage/coding/decoder.py

diff --git a/sage/coding/decoder.py b/sage/coding/decoder.py
 a elements in V (including v) which belong to the syndrome of v (ie, the coset v+C, sorted by weight). EXAMPLES: EXAMPLES:: sage: C = HammingCode(2,GF(3)); C Linear code of length 4, dimension 2 over Finite Field of size 3 sage: V = VectorSpace(GF(3), 4) be in the same ambient space V as C. Returns an element of the syndrome of v of lowest weight. EXAMPLES: EXAMPLES:: sage: C = HammingCode(2,GF(3)); C Linear code of length 4, dimension 2 over Finite Field of size 3 sage: V = VectorSpace(GF(3), 4) Methods implemented include "nearest neighbor" (essentially a brute force search) and "syndrome". EXAMPLES: EXAMPLES:: sage: C = HammingCode(2,GF(3)) sage: V = VectorSpace(GF(3), 4) sage: v = V([0, 2, 0, 1])
• ## sage/databases/sloane.py

diff --git a/sage/databases/sloane.py b/sage/databases/sloane.py
 a OUTPUT: string EXAMPLES: EXAMPLES:: sage: SloaneEncyclopedia.sequence_name(1) # optional - sloane_database 'Number of groups of order n.'
• ## sage/geometry/polyhedron/palp_database.py

diff --git a/sage/geometry/polyhedron/palp_database.py b/sage/geometry/polyhedron/palp_database.py
 a Any additional keyword arguments are passed to :class:PALPreader. EXAMPLES: EXAMPLES:: sage: from sage.geometry.polyhedron.palp_database import Reflexive4dHodge sage: ref = Reflexive4dHodge(1,101)             # optional - polytopes_db_4d
• ## sage/groups/matrix_gps/orthogonal.py

diff --git a/sage/groups/matrix_gps/orthogonal.py b/sage/groups/matrix_gps/orthogonal.py
 a The general orthogonal group of given degree, base ring, and choice of invariant form. EXAMPLES: EXAMPLES:: sage: GO( 3, GF(7)) General Orthogonal Group of degree 3 over Finite Field of size 7
• ## sage/interfaces/gap.py

diff --git a/sage/interfaces/gap.py b/sage/interfaces/gap.py
 a String. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.gap import \ ...       _get_gap_memory_pool_size_MB
• ## sage/interfaces/lie.py

diff --git a/sage/interfaces/lie.py b/sage/interfaces/lie.py
 a To access the LiE interpreter directly, run lie_console(). EXAMPLES: EXAMPLES:: sage: a4 = lie('A4')  # optional - lie sage: lie.diagram('A4')          # optional - lie O---O---O---O logfile=None, server=None): """ EXAMPLES: EXAMPLES:: sage: lie == loads(dumps(lie)) True """ def _read_info_files(self, use_disk_cache=True): """ EXAMPLES: EXAMPLES:: sage: from sage.interfaces.lie import LiE sage: lie = LiE() sage: lie._trait_names_list is None def _repr_(self): """ EXAMPLES: EXAMPLES:: sage: lie LiE Interpreter """ def __reduce__(self): """ EXAMPLES: EXAMPLES:: sage: lie.__reduce__() (, ()) def _function_class(self): """ EXAMPLES: EXAMPLES:: sage: lie._function_class() """ def _quit_string(self): """ EXAMPLES: EXAMPLES:: sage: lie._quit_string() 'quit' """ def _read_in_file_command(self, filename): """ EXAMPLES: EXAMPLES:: sage: lie._read_in_file_command('testfile') Traceback (most recent call last): ... def trait_names(self, type=None, verbose=False, use_disk_cache=True): """ EXAMPLES: EXAMPLES:: sage: lie.trait_names() # optional - lie ['Cartan_type', 'cent_roots', def _an_element_impl(self): """ EXAMPLES: EXAMPLES:: sage: lie._an_element_impl() # optional - lie 0 """ def read(self, filename): """ EXAMPLES: EXAMPLES:: sage: filename = tmp_filename() sage: f = open(filename, 'w') sage: f.write('x = 2\n') """ Spawn a new LiE command-line session. EXAMPLES: EXAMPLES:: sage: lie.console()                    # not tested LiE version 2.2.2 created on Sep 26 2007 at 18:13:19 Authors: Arjeh M. Cohen, Marc van Leeuwen, Bert Lisser. def version(self): """ EXAMPLES: EXAMPLES:: sage: lie.version() # optional - lie '2.1' """ def _object_class(self): """ EXAMPLES: EXAMPLES:: sage: lie._object_class() def _true_symbol(self): """ EXAMPLES: EXAMPLES:: sage: lie._true_symbol() '1' """ def _false_symbol(self): """ EXAMPLES: EXAMPLES:: sage: lie._false_symbol() '0' """ def _equality_symbol(self): """ EXAMPLES: EXAMPLES:: sage: lie._equality_symbol() '==' """ """ Returns a string of the LiE help for command. EXAMPLES: EXAMPLES:: sage: lie.help('diagram') # optional - lie 'diagram(g)...' """ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if_needed=False): """ EXAMPLES: EXAMPLES:: sage: lie._eval_line('2+2') # optional - lie '     4' sage: lie._eval_line('diagram(2)') # optional - lie def eval(self, code, strip=True, **kwds): """ EXAMPLES: EXAMPLES:: sage: lie.eval('2+2')  # optional - lie '4' """ """ Set the variable var to the given value. EXAMPLES: EXAMPLES:: sage: lie.set('x', '2')  # optional - lie sage: lie.get('x')       # optional - lie '2' """ Get the value of the variable var. EXAMPLES: EXAMPLES:: sage: lie.set('x', '2')  # optional - lie sage: lie.get('x')       # optional - lie '2' def get_using_file(self, var): """ EXAMPLES: EXAMPLES:: sage: lie.get_using_file('x') Traceback (most recent call last): ... def function_call(self, function, args=None, kwds=None): """ EXAMPLES: EXAMPLES:: sage: lie.function_call("diagram", args=['A4']) # optional - lie O---O---O---O 1   2   3   4 def _function_element_class(self): """ EXAMPLES: EXAMPLES:: sage: lie._function_element_class() """ """ Returns the possible tab completions for self. EXAMPLES: EXAMPLES:: sage: a4 = lie('A4')   # optional - lie sage: a4.trait_names() # optional - lie ['center', def type(self): """ EXAMPLES: EXAMPLES:: sage: m = lie('[[1,0,3,3],[12,4,-4,7],[-1,9,8,0],[3,-5,-2,9]]') # optional - lie sage: m.type() # optional - lie 'mat' def _matrix_(self, R=None): """ EXAMPLES: EXAMPLES:: sage: m = lie('[[1,0,3,3],[12,4,-4,7],[-1,9,8,0],[3,-5,-2,9]]') # optional - lie sage: matrix(m)  # optional - lie [ 1  0  3  3] def _sage_(self): """ EXAMPLES: EXAMPLES:: sage: m = lie('[[1,0,3,3],[12,4,-4,7],[-1,9,8,0],[3,-5,-2,9]]') # optional - lie sage: m.sage()  # optional - lie [ 1  0  3  3] class LiEFunctionElement(FunctionElement): def _sage_doc_(self): """ EXAMPLES: EXAMPLES:: sage: a4 = lie('A4')  # optional - lie sage: a4.diagram._sage_doc_() # optional - lie 'diagram(g)...' """ Returns the help for self. EXAMPLES: EXAMPLES:: sage: lie.diagram._sage_doc_() # optional - lie 'diagram(g)...' """ def is_LiEElement(x): """ EXAMPLES: EXAMPLES:: sage: from sage.interfaces.lie import is_LiEElement sage: l = lie(2) # optional - lie sage: is_LiEElement(l) # optional - lie def reduce_load_lie(): """ EXAMPLES: EXAMPLES:: sage: from sage.interfaces.lie import reduce_load_lie sage: reduce_load_lie() LiE Interpreter """ Spawn a new LiE command-line session. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.lie import lie_console sage: lie_console()                    # not tested LiE version 2.2.2 created on Sep 26 2007 at 18:13:19 def lie_version(): """ EXAMPLES: EXAMPLES:: sage: from sage.interfaces.lie import lie_version sage: lie_version() # optional - lie '2.1'
• ## sage/interfaces/macaulay2.py

diff --git a/sage/interfaces/macaulay2.py b/sage/interfaces/macaulay2.py
 a \end{enumerate} EXAMPLES: EXAMPLES:: sage: print macaulay2('3/5 + 7/11') #optional 68 -- spaces (or maybe even pieces of output labels). However, this function will try not cut any messages. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.macaulay2 import remove_output_labels sage: output = 'o1 = QQ [x, y]\n\no1 : PolynomialRing\n' sage: remove_output_labels(output) """ Used in serializing an Macaulay2 interface. EXAMPLES: EXAMPLES:: sage: rlm2, t = macaulay2.__reduce__() sage: rlm2(*t) Macaulay2 def __getattr__(self, attrname): """ EXAMPLES: EXAMPLES:: sage: gb = macaulay2.gb  #optional sage: type(gb)           #optional code -- str strip -- ignored EXAMPLES: EXAMPLES:: sage: macaulay2.eval("2+2") #optional 4 """ """ Get the value of the variable var. EXAMPLES: EXAMPLES:: sage: macaulay2.set("a", "2") #optional sage: macaulay2.get("a")      #optional 2 """ Set the variable var to the given value. EXAMPLES: EXAMPLES:: sage: macaulay2.set("a", "2")  #optional sage: macaulay2.get("a")       #optional 2 """ Returns the class of Macaulay2 elements. EXAMPLES: EXAMPLES:: sage: macaulay2._object_class() """ Spawn a new M2 command-line session. EXAMPLES: EXAMPLES:: sage: macaulay2.console()                    # not tested Macaulay 2, version 1.1 with packages: Classic, Core, Elimination, IntegralClosure, LLLBases, Parsing, PrimaryDecomposition, SchurRings, TangentCone """ Returns the Macaulay2 left delimiter for lists. EXAMPLES: EXAMPLES:: sage: macaulay2._left_list_delim() '{' """ """ Returns the Macaulay2 right delimiter for lists. EXAMPLES: EXAMPLES:: sage: macaulay2._right_list_delim() '}' """ """ Returns the Macaulay2 symbol for True. EXAMPLES: EXAMPLES:: sage: macaulay2._true_symbol() 'true' """ """ Returns the Macaulay2 symbol for False. EXAMPLES: EXAMPLES:: sage: macaulay2._false_symbol() 'false' """ """ Returns the Macaulay2 symbol for equality. EXAMPLES: EXAMPLES:: sage: macaulay2._false_symbol() 'false' """ def cputime(self, t=None): """ EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[x,y]")  #optional sage: x,y = R.gens()            #optional sage: a = (x+y+1)^20            #optional """ Returns the version of Macaulay2. EXAMPLES: EXAMPLES:: sage: macaulay2.version() #optional (1, 3, 1) """ OUTPUT: the Macaulay2 ideal generated by the given list of gens EXAMPLES: EXAMPLES:: sage: R2 = macaulay2.ring('QQ', '[x, y]'); R2            # optional QQ[x..y, Degrees => {2:1}, Heft => {1}, MonomialOrder => {MonomialSize => 16}, DegreeRank => 1] {Lex => 2          } OUTPUT: a Macaulay2 ring (with base ring ZZ) EXAMPLES: EXAMPLES:: This is a ring in variables named a through d over the finite field of order 7, with graded reverse lex ordering: sage: R1 = macaulay2.ring('ZZ/7', '[a..d]', 'GRevLex');  R1  # optional def help(self, s): """ EXAMPLES: EXAMPLES:: sage: macaulay2.help("load")  # optional load -- read Macaulay2 commands ******************************* """ Use the Macaulay2 ring R. EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[x,y]")                  #optional sage: P = macaulay2("ZZ/7[symbol x, symbol y]") #optional sage: macaulay2("x").cls()                      #optional Returns a new Macaulay2Element of type type constructed from value. EXAMPLES: EXAMPLES:: sage: l = macaulay2.new_from("MutableList", [1,2,3]) #optional sage: l                                              #optional MutableList{...3...} class Macaulay2Element(ExpectElement): def _latex_(self): """ EXAMPLES: EXAMPLES:: sage: m = macaulay2('matrix {{1,2},{3,4}}') #optional sage: m                                     #optional | 1 2 | def __iter__(self): """ EXAMPLES: EXAMPLES:: sage: l = macaulay2([1,2,3]) #optional sage: list(iter(l))          #optional [1, 2, 3] def __str__(self): """ EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[x,y,z]/(x^3-y^3-z^3)") #optional sage: x = macaulay2('x')                       #optional sage: y = macaulay2('y')                       #optional def external_string(self): """ EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[symbol x, symbol y]")  #optional sage: R.external_string()                      #optional 'QQ[x..y, Degrees => {2:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {2:1}, Position => Up}, DegreeRank => 1]' def __len__(self): """ EXAMPLES: EXAMPLES:: sage: l = macaulay2([1,2,3])  #optional sage: len(l)                  #optional 3 def __getitem__(self, n): """ EXAMPLES: EXAMPLES:: sage: l = macaulay2([1,2,3])  #optional sage: l[0]                    #optional 1 def __setitem__(self, index, value): """ EXAMPLES: EXAMPLES:: sage: l = macaulay2.new_from("MutableList", [1,2,3]) #optional sage: l[0] = 4               #optional sage: list(l)                #optional def __call__(self, x): """ EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[x, y]")     #optional sage: x,y = R.gens()                #optional sage: I = macaulay2.ideal(x*y, x+y) #optional def __nonzero__(self): """ EXAMPLES: EXAMPLES:: sage: a = macaulay2(0)  #optional sage: a == 0            #optional True and ** for exponentiation.   This function is primarily used internally. EXAMPLES: EXAMPLES:: sage: R = macaulay2.ring('QQ','(x,y)')               # optional sage: f = macaulay2('x^3 + 3*y^11 + 5')              # optional sage: print f                                        # optional def structure_sheaf(self): """ EXAMPLES: EXAMPLES:: sage: S = macaulay2('QQ[a..d]')                     # optional sage: R = S/macaulay2('a^3+b^3+c^3+d^3')            # optional sage: X = R.Proj()                                  # optional Note that we have to override the substitute method so that we get the default one from Macaulay2 instead of the one provided by Element. EXAMPLES: EXAMPLES:: sage: R = macaulay2("QQ[x]")            #optional sage: P = macaulay2("ZZ/7[symbol x]")   #optional sage: x, = R.gens()                     #optional Macaulay2's class.  In Macaulay2, class corresponds to Sage's notion of parent. EXAMPLES: EXAMPLES:: sage: macaulay2(ZZ).cls()  #optional Ring ########################## def dot(self, x): """ EXAMPLES: EXAMPLES:: sage: d = macaulay2.new("MutableHashTable") #optional sage: d["k"] = 4                            #optional sage: d.dot("k")                            #optional Returns the infix binary operation specified by opstr applied to self and x. EXAMPLES: EXAMPLES:: sage: a = macaulay2("3")     #optional sage: a._operator("+", a)    #optional 6 def sharp(self, x): """ EXAMPLES: EXAMPLES:: sage: a = macaulay2([1,2,3]) #optional sage: a.sharp(0)             #optional 1 The binary operator ** in Macaulay2 is usually used for tensor or Cartesian power. EXAMPLES: EXAMPLES:: sage: a = macaulay2([1,2]).set()  #optional sage: a.starstar(a)               #optional set {(1, 1), (1, 2), (2, 1), (2, 2)} def underscore(self, x): """ EXAMPLES: EXAMPLES:: sage: a = macaulay2([1,2,3])  #optional sage: a.underscore(0)         #optional 1 #################### def to_sage(self): """ EXAMPLES: EXAMPLES:: sage: macaulay2(ZZ).to_sage()      #optional Integer Ring sage: macaulay2(QQ).to_sage()      #optional class Macaulay2Function(ExpectFunction): def _sage_doc_(self): """ EXAMPLES: EXAMPLES:: sage: print macaulay2.load._sage_doc_()  # optional load -- read Macaulay2 commands ******************************* def _sage_src_(self): """ EXAMPLES: EXAMPLES:: sage: print macaulay2.gb._sage_src_() #optional code(methods gb) ... def is_Macaulay2Element(x): """ EXAMPLES: EXAMPLES:: sage: from sage.interfaces.macaulay2 import is_Macaulay2Element sage: is_Macaulay2Element(2)              #optional False """ Spawn a new M2 command-line session. EXAMPLES: EXAMPLES:: sage: macaulay2_console()                    # not tested Macaulay 2, version 1.1 with packages: Classic, Core, Elimination, IntegralClosure, LLLBases, Parsing, PrimaryDecomposition, SchurRings, TangentCone """ Used for reconstructing a copy of the Macaulay2 interpreter from a pickle. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.macaulay2 import reduce_load_macaulay2 sage: reduce_load_macaulay2() Macaulay2
• ## sage/interfaces/magma_free.py

diff --git a/sage/interfaces/magma_free.py b/sage/interfaces/magma_free.py
 a LIMITATIONS: The code must evaluate in at most 20 seconds and there is a limitation on the amount of RAM. EXAMPLES: EXAMPLES:: sage: magma_free("Factorization(9290348092384)")  # optional - internet [ <2, 5>, <290323377887, 1> ] """ Evaluate MAGMA code without requiring that MAGMA be installed on your computer by using the free online MAGMA calculator. EXAMPLES: EXAMPLES:: sage: magma_free("Factorization(9290348092384)")  # optional - internet [ <2, 5>, <290323377887, 1> ] """

diff --git a/sage/interfaces/mupad.py b/sage/interfaces/mupad.py
• ## sage/interfaces/scilab.py

diff --git a/sage/interfaces/scilab.py b/sage/interfaces/scilab.py
 a """ Interface to the Scilab interpreter. EXAMPLES: EXAMPLES:: sage: a = scilab('[ 1, 1, 2; 3, 5, 8; 13, 21, 33 ]')    # optional - scilab sage: b = scilab('[ 1; 3; 13]')                         # optional - scilab sage: c = a * b                                         # optional - scilab """ Initializes the Scilab class. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.scilab import Scilab sage: sci_obj = Scilab(script_subdirectory='user')  # optional - scilab sage: del sci_obj                                   # optional - scilab """ Returns the string used to quit the pexpect interface. EXAMPLES: EXAMPLES:: sage: scilab._quit_string()                 # optional - scilab 'quit;' """ """ Hints for installing Scilab. EXAMPLES: EXAMPLES:: sage: print scilab._install_hints()               # optional - scilab You must ... """ """ Starts Scilab and sets some options. EXAMPLES: EXAMPLES:: sage: scilab._start()                       # optional - scilab """ Expect._start(self) """ Evaluates commands. EXAMPLES: EXAMPLES:: sage: scilab.eval("5")                      # optional - scilab 'ans  =\n \n    5.' sage: scilab.eval("d=44")                   # optional - scilab nam: first characters of selected names typ: name of selected Scilab variable type EXAMPLES: EXAMPLES:: sage: scilab.whos("core")                   # optional - scilab 'Name                     Type           Size           Bytes...' sage: scilab.whos(typ='function')           # optional - scilab """ Set the variable var to the given value. EXAMPLES: EXAMPLES:: sage: scilab.set('a', 123)        # optional - scilab sage: scilab.get('a')               # optional - scilab '\n \n    123.' """ Get the value of the variable var. EXAMPLES: EXAMPLES:: sage: scilab.eval('b=124;')                 # optional - scilab '' sage: scilab.get('b')                       # optional - scilab """ Starts Scilab console. EXAMPLES: EXAMPLES:: sage: scilab.console()          # optional - scilab; not tested """ """ Returns the version of the Scilab software used. EXAMPLES: EXAMPLES:: sage: scilab.version()                      # optional - scilab 'scilab-...' """ OUTPUT: A string that evaluates to an Scilab matrix. EXAMPLES: EXAMPLES:: sage: M33 = MatrixSpace(QQ,3,3)             # optional - scilab sage: A = M33([1,2,3,4,5,6,7,8,0])          # optional - scilab sage: scilab.sage2scilab_matrix_string(A)   # optional - scilab """ Returns the class of the object. EXAMPLES: EXAMPLES:: sage: scilab._object_class()                # optional - scilab sage: type(scilab(2))                       # optional - scilab """ Use parenthesis for Scilab matrices instead. EXAMPLES: EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]')     # optional - scilab sage: M[1]                                  # optional - scilab 1. """ Sets an element of a matrix. EXAMPLES: EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]')     # optional - scilab sage: M[6] = 0                              # optional - scilab sage: M                                     # optional - scilab r""" Return \sage matrix from this scilab element. EXAMPLES: EXAMPLES:: sage: A = scilab('[1,2;3,4]')       # optional - scilab sage: matrix(ZZ, A)                 # optional - scilab [1 2] """ Set the variable var to the given value. EXAMPLES: EXAMPLES:: sage: scilab.set('c', 125)          # optional - scilab sage: scilab.get('c')               # optional - scilab '\n \n    125.' This requires that the optional Scilab program be installed and in your PATH, but no optional Sage packages need to be installed. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.scilab import scilab_console # optional - scilab sage: scilab_console()                               # optional - scilab; not tested ___________________________________________ """ Return the version of Scilab installed. EXAMPLES: EXAMPLES:: sage: from sage.interfaces.scilab import scilab_version # optional - scilab sage: scilab_version()    # optional - scilab 'scilab-...'
• ## sage/libs/pari/gen_py.py

diff --git a/sage/libs/pari/gen_py.py b/sage/libs/pari/gen_py.py
 a t_REAL:   ComplexField(prec) for equivalent precision t_INTMOD, t_PADIC: raise NotImplementedError EXAMPLES: EXAMPLES:: sage: a = pari('(3+I)').python(); a i + 3 sage: a.parent()
• ## sage/logic/boolformula.py

diff --git a/sage/logic/boolformula.py b/sage/logic/boolformula.py
 a AUTHORS: -- Chris Gorecki EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&((b|c)^a->c)<->b") sage: g = propcalc.formula("boolean<->algebra") sage: (f&~g).ifthen(f) ((a&((b|c)^a->c)<->b)&(~(boolean<->algebra)))->(a&((b|c)^a->c)<->b) EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&((b|c)^a->c)<->b") sage: g = propcalc.formula("boolean<->algebra") Effectively returns an instance of this class. EXAMPLES: This example illustrates the creation of a statement. This example illustrates the creation of a statement.:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s OUTPUT: Returns the string representation of this statement. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: propcalc.formula("man->monkey&human") man->monkey&human OUTPUT: Returns the latex representation of this statement. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man->monkey&human") sage: latex(s) OUTPUT: A list containing the parse tree of self. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man -> monkey & human") sage: s.tree() OUTPUT: Returns a new statement that is the first statement logically or'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns a new statement that is the first statement logically and'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns a new statement that is the first statement logically xor'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns a new statement that is the first statement logically xor'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns a new statement that is the first statement logically not'ed. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: ~s Returns a new statement that is the first statement logically ifthen'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns a new statement that is the first statement logically ifandonlyif'ed together. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") Returns true if the left hand side is equivalent to the right hand side, and false otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("(a|b)&c") sage: g = propcalc.formula("c&(b|a)") tacked on the front) corresponding to the statement. EXAMPLES: This example illustrates the creation of a statement. This example illustrates the creation of a statement.:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s.truthtable() Return the evaluation of the formula with the given inputs, either True or False. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&b|c") sage: f.evaluate({'a':False, 'b':False, 'c':True}) OUTPUT: True if the formula can be satisfied, False otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a|b") sage: f.is_satisfiable() OUTPUT: True if the formula is a tautology, False otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a|~a") sage: f.is_tautology() OUTPUT: True if the formula is a contradiction, False otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&~a") sage: f.is_contradiction() True if the two formulas are logically equivalent, False otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("(a|b)&c") sage: g = propcalc.formula("c&(a|b)") An instance of boolformula with an identical truth table that is in conjunctive normal form. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a^b<->c") sage: s.convert_cnf_recur() OUTPUT: A string representing the satformat representation of this object. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&((b|c)^a->c)<->b") sage: f.convert_cnf() #        OUTPUT: #            A simplified expression. # #        EXAMPLES: #        EXAMPLES:: # #            sage: import sage.logic.propcalc as propcalc #            sage: f = propcalc.formula("a&((b|c)^a->c)<->b") #            sage: f.truthtable() OUTPUT: A tree branch that does not contain ^, ->, or <-> operators. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("a&(b|~c)") sage: tree = ['&', 'a', ['|', 'b', ['~', 'c', None]]] Returns a new statement that is the first statement attached to the second statement by the operator op. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") OUTPUT: returns True if bit c of number x is 1, False otherwise. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: s.get_bit(2, 1) OUTPUT: A tree branch that does not contain ^, ->, or <-> operators. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("a->b^c") sage: tree = ['->', 'a', ['^', 'b', 'c']] OUTPUT: A tree branch that does not contain un-distributed nots. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("~(a&b)") sage: tree = ['~', ['&', 'a', 'b'], None] OUTPUT: A tree branch that does not contain un-distributed ors. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("(a&b)|(a&c)") sage: tree = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] OUTPUT: A tree branch in infix form. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("(a&b)|(a&c)") sage: tree = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] OUTPUT: None. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a^b<->c") sage: s.convert_cnf_recur(); s  #long time OUTPUT: The next operator in the string. EXAMPLES: EXAMPLES:: sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("f&p") sage: s.get_next_op("abra|cadabra")
• ## sage/logic/logic.py

diff --git a/sage/logic/logic.py b/sage/logic/logic.py
 a class SymbolicLogic: """ EXAMPLES: EXAMPLES:: sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) and a list of the variable names in the order they were found EXAMPLES: This example illustrates the creation of a statement. This example illustrates the creation of a statement.:: sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") tacked on the front) corresponding to the statement EXAMPLES: This example illustrates the creation of a statement. This example illustrates the creation of a statement.:: sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) #creates the whole truth table the truthtable (which is basically a 2-d array). EXAMPLES: This example illustrates the creation of a statement. This example illustrates the creation of a statement.:: sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) #creates the whole truth table
• ## sage/logic/logicparser.py

diff --git a/sage/logic/logicparser.py b/sage/logic/logicparser.py
 a AUTHORS: -- Chris Gorecki EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.parse(s) OUTPUT: Returns the tuple (parse tree of s, variables in s). EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.parse(s) OUTPUT: Returns a tuple consisting of (tokens in s, variables in s). EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.tokenize(s) OUTPUT: Returns a parse tree of the tokens toks. EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: t = ['(', 'a', '|', 'b', '&', 'c', ')'] sage: logicparser.tree_parse(t) OUTPUT: Returns a parse tree of the tokens toks. EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: t = ['a', '|', 'b', '&', 'c'] sage: logicparser.parse_ltor(t) Returns a parse tree after func has been applied to it. EXAMPLES: EXAMPLES:: sage: import sage.logic.logicparser as logicparser sage: t = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] sage: f = lambda t: t
• ## sage/matrix/matrix_integer_dense_hnf.py

diff --git a/sage/matrix/matrix_integer_dense_hnf.py b/sage/matrix/matrix_integer_dense_hnf.py
 a OUTPUT: A triple (det bound, new z_so_far, new N_so_far). EXAMPLES: EXAMPLES:: sage: a = matrix(ZZ, 3, [6, 1, 2, -56, -2, -1, -11, 2, -3]) sage: factor(a.det()) -1 * 13 * 29 OUTPUT: a pair of two integers. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_hnf import double_det sage: A = matrix(ZZ, 2, 3, [1,2,3, 4,-2,5]) sage: b = matrix(ZZ, 1, 3, [1,-2,5]) OUTPUT: x   -- a vector such that H' = H_B.augment(x) is the HNF of A = B.augment(a). EXAMPLES: EXAMPLES:: sage: B = matrix(ZZ,3, [-1, -1, 1, -3, 8, -2, -1, -1, -1]) sage: a = matrix(ZZ,3,1, [1,2,3]) sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf OUTPUT: the unique solution to B*x = a. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_hnf import solve_system_with_difficult_last_row sage: B = matrix(ZZ, 3, [1,2,4, 3,-4,7, 939082,2930982,132902384098234]) sage: a = matrix(ZZ,3,1, [1,2,5]) OUTPUT: x   -- a vector such that H' = H_B.augment(x) is the HNF of A = B.augment(a). EXAMPLES: EXAMPLES:: sage: B = matrix(ZZ, 3, 3, [1,2,5, 0,-5,3, 1,1,2]) sage: H_B = B.echelon_form() sage: a = matrix(ZZ, 3, 1, [1,8,-2]) H -- the Hermite normal form of A.stack(b). new_pivots -- the pivot columns of H. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as hnf sage: A = matrix(ZZ, 2, 3, [-21, -7, 5, 1,20,-7]) sage: b = matrix(ZZ, 1,3, [-1,1,-1]) OUTPUT: list -- list of pivots EXAMPLES: EXAMPLES:: sage: H = matrix(ZZ, 3, 5, [1, 0, 0, 45, -36, 0, 1, 0, 131, -107, 0, 0, 0, 178, -145]); H [   1    0    0   45  -36] [   0    1    0  131 -107] OUTPUT: the Hermite normal form of A. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as hnf sage: A = matrix(ZZ, 3, [-21, -7, 5, 1,20,-7, -1,1,-1]) sage: hnf.hnf_square(A, False) of A at the positions specified by cols1 and the columns of B at the positions specified by cols2. EXAMPLES: EXAMPLES:: sage: A = matrix(ZZ, 2, [1,2,3,4]); B = matrix(ZZ, 2, [-1,5,2,3]) sage: A [1 2] OUTPUT: a tuple of integers EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: a = matrix(ZZ,3,[0, -1, -1, 0, -20, 1, 0, 1, 2]) sage: a OUTPUT: a tuple of integers EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: a = matrix(ZZ,3,[0, -1, -1, 0, -20, 1, 0, 1, 2]) sage: a OUTPUT: 4-tuple of integer lists: onecol, onerow, non_oneol, non_onerow EXAMPLES: EXAMPLES:: sage: H = matrix(ZZ, 3, 5, [1, 0, 0, 45, -36, 0, 1, 0, 131, -107, 0, 0, 0, 178, -145]); H [   1    0    0   45  -36] [   0    1    0  131 -107] If D isn't invertible or there are 0 or more than 2 non onecols, then C, D, and E are set to None. EXAMPLES: EXAMPLES:: sage: H = matrix(ZZ, 3, 4, [1, 0, 0, 7, 0, 1, 5, 2, 0, 0, 6, 6]) sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: matrix_integer_dense_hnf.extract_ones_data(H, [0,1,2]) OUTPUT: bool -- True or False EXAMPLES: EXAMPLES:: sage: a = matrix(ZZ,3,5,[-2, -6, -3, -17, -1, 2, -1, -1, -2, -1, -2, -2, -6, 9, 2]) sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: matrix_integer_dense_hnf.is_in_hnf_form(a,range(3)) the Hermite normal form of A. cols -- pivot columns EXAMPLES: EXAMPLES:: sage: a = matrix(ZZ,4,3,[-1, -1, -1, -20, 4, 1, -1, 1, 2,1,2,3]) sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: matrix_integer_dense_hnf.probable_hnf(a, True, True) OUTPUT: a matrix with nrows rows. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: a = matrix(ZZ, 2, 4, [1, 0, 0, 7, 0, 1, 5, 2]) sage: matrix_integer_dense_hnf.pad_zeros(a, 4) matrix -- the Hermite normal form of A pivots -- the pivot column positions of A EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: a = matrix(ZZ,3,5,[-2, -6, -3, -17, -1, 2, -1, -1, -2, -1, -2, -2, -6, 9, 2]) sage: matrix_integer_dense_hnf.hnf(a) U -- a unimodular matrix such that U * A = H pivots -- the pivot column positions of A EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: A = matrix(ZZ, 2, [1, -5, -10, 1, 3, 197]); A [  1  -5 -10] Use this to randomly test that hnf with transformation matrix is working. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_hnf import hnf_with_transformation_tests sage: hnf_with_transformation_tests(n=15,m=10, trials=10) 0 1 2 3 4 5 6 7 8 9 """ Run benchmark program. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as hnf sage: hnf.benchmark_hnf([50,100],32) ('sage', 50, 32, ...), def benchmark_magma_hnf(nrange, bits=4): """ EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as hnf sage: hnf.benchmark_magma_hnf([50,100],32)     # optional - magma ('magma', 50, 32, ...), aren't normalized to be nonnegative) the default is Magma. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_hnf as matrix_integer_dense_hnf sage: matrix_integer_dense_hnf.sanity_checks(times=5, check_using_magma=False) small 8 x 5
• ## sage/matrix/matrix_integer_dense_saturation.py

diff --git a/sage/matrix/matrix_integer_dense_saturation.py b/sage/matrix/matrix_integer_dense_saturation.py
 a The p-saturation of the matrix A, i.e., a new matrix in Hermite form whose row span a ZZ-module that is p-saturated. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_saturation import p_saturation sage: A = matrix(ZZ, 2, 2, [3,2,3,4]); B = matrix(ZZ, 2,3,[1,2,3,4,5,6]) sage: A.det() OUTPUT: a randomly chosen sublist of range(k) of size n. EXAMPLES: EXAMPLES:: sage: import sage.matrix.matrix_integer_dense_saturation as s sage: s.random_sublist_of_size(10,3) [0, 1, 5] OUTPUT: the unique solution to B*Z = A. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_saturation import solve_system_with_difficult_last_row sage: B = matrix(ZZ, 3, [1,2,3, 3,-1,2,939239082,39202803080,2939028038402834]); A = matrix(ZZ,3,2,[1,2,4,3,-1,0]) sage: X = solve_system_with_difficult_last_row(B, A); X OUTPUT: matrix -- saturation of the matrix A. EXAMPLES: EXAMPLES:: sage: from sage.matrix.matrix_integer_dense_saturation import saturation sage: A = matrix(ZZ, 2, 2, [3,2,3,4]); B = matrix(ZZ, 2,3,[1,2,3,4,5,6]); C = A*B sage: C
• ## sage/matrix/symplectic_basis.py

diff --git a/sage/matrix/symplectic_basis.py b/sage/matrix/symplectic_basis.py
 a WARNING: not intended for external use! EXAMPLES: EXAMPLES:: sage: from sage.matrix.symplectic_basis import _inplace_move_to_positive_pivot sage: E = matrix(ZZ, 4, 4, [0, 16, 0, 2, -16, 0, 0, -4, 0, 0, 0, 0, -2, 4, 0, 0]); E [  0  16   0   2] See the examples for a pictorial description of such a basis. EXAMPLES: EXAMPLES:: sage: from sage.matrix.symplectic_basis import symplectic_basis_over_field A full rank exact example: WARNING: not intended for external use! EXAMPLES: EXAMPLES:: sage: from sage.matrix.symplectic_basis import _smallest_element_position_or_None sage: E = matrix(ZZ, 4, 4, [0, 16, 0, 2, -16, 0, 0, -4, 0, 0, 0, 0, -2, 4, 0, 0]); E See the examples for a pictorial description of such a basis. EXAMPLES: EXAMPLES:: sage: from sage.matrix.symplectic_basis import symplectic_basis_over_ZZ An example which does not have full rank:
• ## sage/misc/banner.py

diff --git a/sage/misc/banner.py b/sage/misc/banner.py
 a OUTPUT: str EXAMPLES: EXAMPLES:: sage: version() 'Sage Version ..., Release Date: ...' sage: version(clone=True) If the Sage version is '3.2.alpha0', then the dictionary is {'major': 3, 'minor': 2, 'tiny': 0, 'prerelease': True}. EXAMPLES: EXAMPLES:: sage: from sage.misc.banner import version_dict sage: print "Sage major version is %s" % version_dict()['major'] Sage major version is ... If optional argument print_message is True and this function is returning False, print a warning message. EXAMPLES: EXAMPLES:: sage: from sage.misc.banner import require_version sage: require_version(2, 1, 3) True
• ## sage/misc/explain_pickle.py

diff --git a/sage/misc/explain_pickle.py b/sage/misc/explain_pickle.py
 a Create a new object; this corresponds to the C code klass->tp_new(klass, args, NULL).  Used by explain_pickle. EXAMPLES: EXAMPLES:: sage: unpickle_newobj(tuple, ([1, 2, 3],)) (1, 2, 3) """ r""" Print an EmptyOldstyleClass. EXAMPLES: EXAMPLES:: sage: from sage.misc.explain_pickle import * sage: v = EmptyOldstyleClass() sage: v r""" Produce a predictable hash value for EmptyOldstyleClass. EXAMPLES: EXAMPLES:: sage: from sage.misc.explain_pickle import * sage: v = EmptyOldstyleClass() sage: hash(v) of TestGlobalOldName, it is redirected to create an instance of this class instead.  Used for testing explain_pickle. EXAMPLES: EXAMPLES:: sage: from sage.misc.explain_pickle import * sage: loads(dumps(TestGlobalOldName())) TestGlobalNewName

diff --git a/sage/misc/map_threaded.py b/sage/misc/map_threaded.py
 a Apply the function to the elements in the sequence by threading recursively through all sub-sequences in the sequence. EXAMPLES: EXAMPLES:: sage: map_threaded(log, [[1,2], [3,e]]) [[0, log(2)], [log(3), 1]] sage: map_threaded(log, [(1,2), (3,e)])
• ## sage/misc/remote_file.py

diff --git a/sage/misc/remote_file.py b/sage/misc/remote_file.py
 a creates a file in the temp directory and returns the absolute path to that file. EXAMPLES: EXAMPLES:: sage: g = get_remote_file("http://sagemath.org/ack.html", verbose=False)   # optional - internet sage: len(open(g).read())   # optional; randomly growing. 10198
• ## sage/misc/sage_input.py

diff --git a/sage/misc/sage_input.py b/sage/misc/sage_input.py
 a \function{sage_eval}.  (Otherwise, if \function{sage_input} cannot handle a value, an exception is raised.) EXAMPLES: EXAMPLES:: sage: sage_input(GF(2)(1)) GF(2)(1) sage: sage_input((GF(2)(0), GF(2)(1)), verify=True) internally by \function{sage_input}, but it may be useful to create an instance directly for testing or doctesting. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder We can create a \class{SageInputBuilder}, use it to create some If \code{None}, then the result will work whether or not the preparser is enabled. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: SageInputBuilder().preparse() True \code{self._allow_locals} is true, we add it to a locals'' dictionary. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() methods of \class{Integer} and \class{RealNumber}; but most \method{_sage_input_} methods will not need to examine this. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: SageInputBuilder().preparse() True a \class{long}, depending on its size and whether the preparser is enabled). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() produces a \class{SageInputExpression} that formats as that string. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Given a string representing a Python name, produces a \class{SageInputExpression} for that name. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() are both large and likely to be used multiple times in a single expression. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \method{cache} if equality on the values is difficult or impossible to compute. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: x = polygen(ZZ) Creates an expression that will import a name from a module and then use that name. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Can only be used as an argument to the \method{command} method. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Attaches a command to v, which will be executed before v is used. Multiple commands will be executed in the order added. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() produces a \class{SageInputExpression} representing the dictionary. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() is some attribute that bypasses __getattr__ (such as if bar is '__getattr__' itself). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Since this is not legal Python syntax, it is useful only for producing the \sage generator syntax for a polynomial ring. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() is the final top-level expression, though, it will not use a variable.) EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() by a variable if it occurs multiple times in the expression. (Most non-single-token expressions are already sharable.) EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder Without explicitly using .share(), string literals are not shared: generator syntax is used; typically this will be the same as the first SIE except omitting a \var{names} parameter. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder Given a parent, returns a \class{SageInputExpression} for the $n$th (default 0) generator of the parent. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() And any negations are removed from the elements and moved to the outside of the product. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() element in the sequence); and any instances of \code{a + -b} are changed to \code{a - b}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() (and possibly a dictionary of local variables) suitable for \function{sage_eval}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Initialize a \class{SageInputExpression}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() enough that duplicate uses are not worth caching.  Normally this will be true if the expression represents a single token. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SageInputExpression}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() to replace with a variable (rather than generating the value multiple times). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() and register it with a \class{SageInputFormatter} (which will allocate a variable name at the end of the preparatory phase). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() Get the variable name that the \class{SageInputFormatter} allocated for this \class{SageInputExpression}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() See the documentation for \method{SIE_unary._sie_is_negation} for useful examples. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() \class{SageInputExpression} representing a function call node (with \code{self} as the function). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Currently, slices are not supported. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Given a \class{SageInputExpression}, build a new \class{SageInputExpression} representing an attribute access. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{self ** other}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{self * other}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{self / other}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{self + other}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{self - other}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() where OP is a string representing a binary operator (such as '+' or '**'). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{-self}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{~self}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Compute an expression tree for \code{abs(self)}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() where OP is a string representing a unary operator (such as '-' or '~'). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Actually, all of these are examples of the \method{_sie_format} method on subclasses of \class{SageInputExpression}; \class{SageInputExpression} itself is an abstract base class (that cannot be instantiated). (that cannot be instantiated).:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter an error.  (This is to prevent accidental use of \class{SIE_assign} as a value.) EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() An abstract base class for literals'' (basically, values which consist of a single token). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SIE_literal sage: sib = SageInputBuilder() variables (for common subexpression elimination'') even if they occur multiple times in an expression. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() string representation of that token.  They are used for integer, floating-point, and string literals, and for name expressions. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SIE_literal_stringrep sage: sib = SageInputBuilder() sib -- a \class{SageInputBuilder} n -- a string; the value to be printed for this expression EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a string representing this \class{SIE_literal_stringrep} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and an indication that it is atomic'' (never needs to be parenthesized). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a function-call node in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \class{SageInputExpression}s representing the keyword arguments EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_call} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a list of the immediate subexpressions of this \class{SIE_call}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and an indication that it is a function call. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a subscript node in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() empty subscript.  This is not legal Python syntax, but it is legal in the \sage preparser in examples like \code{K. = QQ[]}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_subscript} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_subscript}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and an indication that it is a subscript. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a getattr node in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() obj -- a \class{SageInputExpression} representing an object attr -- a string; the attribute name EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_getattr} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_subscript}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and an indication that it is an attribute reference. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a tuple or list node in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() is_list -- is True if this class represents a list, False for a tuple EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_tuple} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_tuple}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this tuple or list, and an indication that it is atomic (never needs to be parenthesized). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a dict node in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \class{SageInputExpression}s representing the entries of this dict EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_dict} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_dict}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this dict, and an indication that it is atomic (never needs to be parenthesized). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents an arithmetic expression with a binary operator and its two arguments, in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() lhs -- a \class{SageInputExpression} rhs -- a \class{SageInputExpression} EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_binary} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a tuple of the immediate subexpressions of this \class{SIE_binary}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and the precedence of the top-level operator in the expression. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents an arithmetic expression with a unary operator and its argument, in a \function{sage_input} expression tree. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() op -- a string representing a unary operator, such as '-' operand -- a \class{SageInputExpression} EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_unary} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_unary}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Return the formatted string value of this expression, and the precedence of the top-level operator in the expression. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() produce \code{-CC(3)} instead of \code{CC(-3)}.  (This is preferred so that you get \code{x - CC(3)} instead of \code{x + CC(-3)}.) EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() with named generators, optionally using the \sage preparser generators syntax (like \code{K. = QQ[]}). EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() for constructing this parent using the \sage preparser generators syntax EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_gens_constructor} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \class{SIE_gens_constructor}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \class{SIE_gens_constructor} is used.  (This means we will actually construct all of the generators.) EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() Build commands to construct this parent and (if necessary) its associated generators. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() As a side effect, if the generators of this parent are used, this adds commands to assign the generators to names. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() This class represents a named generator of a parent with named generators. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() parent -- a \class{SIE_gens_constructor} name -- a string with the name of this generator EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_gen} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Report that \class{SIE_gen} values are single tokens. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() \class{SageInputExpression} to additionally mark the parent of this generator that the generator names must be assigned. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() As a side effect, this generates commands to assign the generators of the parent to variables. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() variable name which is the same as the name of the generator name. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter First we verify that if we use two generators with different r""" This class represents a name which has been imported from a module. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() alt_name -- an alternate object name, or None (the default) to use name EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_import_name} value. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Report that \class{SIE_import_name} values are single tokens. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() We override the \method{_sie_prepare} method from \class{SageInputExpression} to request a variable name. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() Return the formatted string value of this import, and an indication that it is atomic. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() r""" This class represents an assignment command. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() lhs -- the left-hand side of the assignment rhs -- the right-hand side of the assignment EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() r""" Returns a string representing this \class{SIE_assign} command. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() Returns a list of the immediate subexpressions of this \class{SIE_assign}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder sage: sib = SageInputBuilder() as an expression.  Since an assignment is a statement, not an expression, always raises an error. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() Return the formatted string of this \class{SIE_assign} as a statement. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() r""" Initialize an instance of \class{SageInputFormatter}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputFormatter sage: sif = SageInputFormatter() Otherwise, we format the expression by calling its \method{_sie_format} method, and add parentheses if necessary. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() If the input name is \code{None}, then it is treated as a name of \code{'si'}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputFormatter sage: sif = SageInputFormatter() If the input name is \code{None}, then it is treated as a name of \code{'si'}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputFormatter sage: sif = SageInputFormatter() If the values are the same, we return \code{None}; otherwise, we raise an exception. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import verify_same sage: verify_same(1, 1) sage: verify_same(1, 2) On success, we return \code{None}; on failure, we raise an exception. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import verify_si_answer sage: verify_si_answer(1, '1', True) sage: verify_si_answer(1, '1', False) This class inherits from tuple, so it acts like a tuple when passed to \function{sage_eval}; but it prints as a sequence of commands. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputAnswer sage: v = SageInputAnswer('x = 22\n', 'x/7'); v x = 22 r""" Construct an instance of \class{SageInputAnswer}. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputAnswer sage: v = SageInputAnswer('', 'sin(3.14)', {'sin': math.sin}); v LOCALS: \sage command line, you get a result in a nice form ready to copy-and-paste. EXAMPLES: EXAMPLES:: sage: from sage.misc.sage_input import SageInputAnswer sage: v = SageInputAnswer('', 'sin(3.14)', {'sin': math.sin}); v LOCALS:
• ## sage/modular/modform/j_invariant.py

diff --git a/sage/modular/modform/j_invariant.py b/sage/modular/modform/j_invariant.py
 a WARNING: Stupid algorithm -- we divide by Delta, which is slow. EXAMPLES: EXAMPLES:: sage: j_invariant_qexp(4) q^-1 + 744 + 196884*q + 21493760*q^2 + 864299970*q^3 + O(q^4) sage: j_invariant_qexp(2)
• ## sage/modular/modform/theta.py

diff --git a/sage/modular/modform/theta.py b/sage/modular/modform/theta.py
 a OUTPUT: a power series over K EXAMPLES: EXAMPLES:: sage: theta2_qexp(18) q + q^9 + O(q^18) sage: theta2_qexp(49) OUTPUT: a power series over K EXAMPLES: EXAMPLES:: sage: theta_qexp(25) 1 + 2*q + 2*q^4 + 2*q^9 + 2*q^16 + O(q^25) sage: theta_qexp(10)
• ## sage/modular/overconvergent/hecke_series.py

diff --git a/sage/modular/overconvergent/hecke_series.py b/sage/modular/overconvergent/hecke_series.py
 a - list of q-expansions (to same finite precision), and q-expansion. EXAMPLES: EXAMPLES:: sage: from sage.modular.overconvergent.hecke_series import compute_Wi sage: p = 17

diff --git a/sage/modules/free_quadratic_module.py b/sage/modules/free_quadratic_module.py
 a to create free modules.  \emph{Do not use the FreeModule\_xxx constructors directly.} EXAMPLES: EXAMPLES:: sage: M = Matrix(QQ,[[2,1,0],[1,2,1],[0,1,2]]) sage: V = VectorSpace(QQ,3,inner_product_matrix=M) sage: type(V) inner product matrix.} EXAMPLES: EXAMPLES:: sage: M1 = FreeQuadraticModule(ZZ,2,inner_product_matrix=1) sage: M1 is FreeModule(ZZ,2,inner_product_matrix=1) def QuadraticSpace(K, dimension, inner_product_matrix, sparse=False): """ EXAMPLES: The base can be complicated, as long as it is a field. The base can be complicated, as long as it is a field.:: sage: F. = FractionField(PolynomialRing(ZZ,'x')) sage: D = diagonal_matrix([x,x-1,x+1]) sage: V = QuadraticSpace(F,3,D) """ Returns True if M is a free quadratic module. EXAMPLES: EXAMPLES:: sage: from sage.modules.free_quadratic_module import is_FreeQuadraticModule sage: U = FreeModule(QQ,3) sage: is_FreeQuadraticModule(U) base_ring -- a commutative ring rank -- a non-negative integer EXAMPLES: EXAMPLES:: sage: R = PolynomialRing(QQ,3,'x') sage: FreeModule(R,3,inner_product_matrix=diagonal_matrix(list(R.gens()))) Ambient free quadratic module of rank 3 over the integral domain Multivariate Polynomial Ring in x0, x1, x2 over Rational Field N.B. This function is for internal use only! See dense_module for use. EXAMPLES: EXAMPLES:: sage: A = diagonal_matrix([1,2,2]) sage: M = FreeModule(Integers(8),3,inner_product_matrix=A) sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True) N.B. This function is for internal use only! See sparse_module for use. EXAMPLES: EXAMPLES:: sage: A = diagonal_matrix([1,2,2]) sage: M = FreeModule(Integers(8),3,inner_product_matrix=A) sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True) """ Return the ambient module associated to this module. EXAMPLES: EXAMPLES:: sage: R. = QQ[] sage: M = FreeModule(R,2) sage: M.ambient_module() G = B*A*B.transpose(), where A is the inner product matrix (induced from the ambient space), and B the basis matrix. EXAMPLES: EXAMPLES:: sage: V = VectorSpace(QQ,4) sage: u = V([1/2,1/2,1/2,1/2]) sage: v = V([0,1,1,0]) the module and/or ambient space.  E.g. On an integral module over ZZ the inner product pairing could naturally take values in ZZ, QQ, RR, or CC. EXAMPLES: EXAMPLES:: sage: M = FreeModule(ZZ, 3) sage: M.inner_product_matrix() [1 0 0] the dot product on the ambient vector space.  This is used internally by the inner_product function for optimization. EXAMPLES: EXAMPLES:: sage: FreeModule(ZZ, 3)._inner_product_is_dot_product() True sage: FreeModule(ZZ, 3, inner_product_matrix=1)._inner_product_is_dot_product() while FreeQuadraticModules must have an inner_product_matrix, although it can be diagonal. EXAMPLES: EXAMPLES:: sage: M0 = FreeModule(ZZ, 3, inner_product_matrix=1) sage: M0._inner_product_is_diagonal() True """ Create a free module over a PID. EXAMPLES: EXAMPLES:: sage: FreeModule(ZZ, 2, inner_product_matrix=Matrix([[2,1],[1,2]])) Ambient free quadratic module of rank 2 over the principal ideal domain Integer Ring Inner product matrix: It must, however, be contained in the ambient vector space, i.e., the ambient space tensored with the fraction field of R. EXAMPLES: EXAMPLES:: sage: V = FreeModule(ZZ,3) sage: W = V.submodule([V.gen(0)]) sage: W.span([V.gen(1)]) must, however, be contained in the ambient vector space, i.e., the ambient space tensored with the fraction field of R. EXAMPLES: EXAMPLES:: sage: M = FreeModule(ZZ,3) sage: W = M.span_of_basis([M([1,2,3])]) """ Return the zero submodule of this module. EXAMPLES: EXAMPLES:: sage: V = FreeModule(ZZ,2) sage: V.zero_submodule() Free module of degree 2 and rank 0 over Integer Ring already_echelonized -- bool (default: False): set this if you know the gens are already in echelon form EXAMPLES: EXAMPLES:: sage: V = VectorSpace(GF(7), 3) sage: W = V.subspace([[2,3,4]]); W Vector space of degree 3 and dimension 1 over Finite Field of size 7 already_echelonized -- bool (default: False): set this if you know the gens are already in echelon form EXAMPLES: EXAMPLES:: sage: V = VectorSpace(GF(7), 3) sage: W = V.subspace([[2,3,4]]); W Vector space of degree 3 and dimension 1 over Finite Field of size 7 base_ring -- a commutative ring rank -- a non-negative integer EXAMPLES: EXAMPLES:: sage: FreeModule(ZZ, 4) Ambient free module of rank 4 over the principal ideal domain Integer Ring """ """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: R = ZZ.quo(12) sage: M = R^12 sage: print M dimension, then in order by their echelon matrices. EXAMPLES: We compare rank three free modules over the integers and rationals: We compare rank three free modules over the integers and rationals:: sage: QQ^3 < CC^3 True sage: CC^3 < QQ^3 r""" Return a latex representation of this ambient free quadratic module. EXAMPLES: EXAMPLES:: sage: latex(QQ^3) # indirect doctest \Bold{Q}^{3} N.B. This function is for internal use only! See dense_module for use. EXAMPLES: EXAMPLES:: sage: A = diagonal_matrix([1,2,2]) sage: M = FreeModule(Integers(8),3,inner_product_matrix=A) sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True) N.B. This function is for internal use only! See sparse_module for use. EXAMPLES: EXAMPLES:: sage: A = diagonal_matrix([1,2,2]) sage: M = FreeModule(Integers(8),3,inner_product_matrix=A) sage: S = FreeModule(Integers(8),3,inner_product_matrix=A,sparse=True) """ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False): """ EXAMPLES: EXAMPLES:: sage: FreeModule(PolynomialRing(GF(5),'x'), 3) Ambient free module of rank 3 over the principal ideal domain Univariate Polynomial Ring in x over Finite Field of size 5 """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: R = PolynomialRing(ZZ,'x') sage: M = FreeModule(R,7) sage: print M Returns the ambient vector space, which is this free module tensored with its fraction field. EXAMPLES: EXAMPLES:: sage: M = ZZ^3;  M.ambient_vector_space() Vector space of dimension 3 over Rational Field """ sparse -- bool (default: False) inner_product_matrix -- bool (default: None) EXAMPLES: EXAMPLES:: sage: ZZ^3 Ambient free module of rank 3 over the principal ideal domain Integer Ring sage: FreeModule(ZZ,3,inner_product_matrix=Matrix([[2,-1,0],[-1,2,-1],[0,-1,2]])) """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: M = FreeModule(ZZ, 2, inner_product_matrix=[[2,-1],[-1,2]]) sage: M Ambient free quadratic module of rank 2 over the principal ideal domain Integer Ring dimension -- a non-negative integer sparse -- bool (default: False) EXAMPLES: EXAMPLES:: sage: VectorSpace(QQ,3,inner_product_matrix=[[2,1,0],[1,2,0],[0,1,2]]) Ambient quadratic space of dimension 3 over Rational Field Inner product matrix: """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: V = FreeModule(QQ,7) sage: print V Vector space of dimension 7 over Rational Field """ Create a free module with basis over a PID. EXAMPLES: EXAMPLES:: sage: A = diagonal_matrix([1,2,2]) sage: M = FreeQuadraticModule(ZZ,3,inner_product_matrix=A) """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: L = ZZ^8 sage: E = L.submodule_with_basis([ L.gen(i) - L.gen(0) for i in range(1,8) ]) sage: E # indirect doctest is a submodule of another. EXAMPLES: First we compare two equal vector spaces. First we compare two equal vector spaces.:: sage: V = span([[1,2,3], [5,6,7], [8,9,10]], QQ) sage: W = span([[5,6,7], [8,9,10]], QQ) sage: V == W r""" Return latex representation of this free module. EXAMPLES: EXAMPLES:: sage: A = ZZ^3 sage: M = A.span_of_basis([[1,2,3],[4,5,6]]) sage: M._latex_() R -- a principal ideal domain EXAMPLES: Changing rings preserves the inner product and the user basis: Changing rings preserves the inner product and the user basis:: sage: V = QQ^3 sage: W = V.subspace([[2, '1/2', 1]]); W An $R$-submodule of $K^n$ where $K$ is the fraction field of a principal ideal domain $R$. EXAMPLES: EXAMPLES:: sage: M = ZZ^3 sage: W = M.span_of_basis([[1,2,3],[4,5,19]]); W Free module of degree 3 and rank 2 over Integer Ring """ Create an embedded free module over a PID. EXAMPLES: EXAMPLES:: sage: V = ZZ^3 sage: W = V.span([[1,2,3],[4,5,6]]) sage: W """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: M = FreeModule(ZZ,8,inner_product_matrix=1) sage: L = M.submodule([ M.gen(i) - M.gen(0) for i in range(1,8) ]) sage: print L # indirect doctest """ An embedded vector subspace with a distinguished user basis. EXAMPLES: EXAMPLES:: sage: M = QQ^3; W = M.submodule_with_basis([[1,2,3], [4,5,19]]); W Vector space of degree 3 and dimension 2 over Rational Field User basis matrix: """ Create a vector space with given basis. EXAMPLES: EXAMPLES:: sage: V = QQ^3 sage: W = V.span_of_basis([[1,2,3],[4,5,6]]) sage: W """ The printing representation of self. EXAMPLES: EXAMPLES:: sage: V = VectorSpace(QQ,5) sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ]) sage: print U # indirect doctest EXAMPLES: Since this is an embedded vector subspace with echelonized basis, the echelon_coordinates() and user coordinates() agree: the echelon_coordinates() and user coordinates() agree:: sage: V = QQ^3 sage: W = V.span([[1,2,3],[4,5,6]]) """ Create an embedded vector subspace with echelonized basis. EXAMPLES: EXAMPLES:: sage: V = QQ^3 sage: W = V.span([[1,2,3],[4,5,6]]) sage: W """ The default printing representation of self. EXAMPLES: EXAMPLES:: sage: V = VectorSpace(QQ,5) sage: U = V.submodule([ V.gen(i) - V.gen(0) for i in range(1,5) ]) sage: print U # indirect doctest
• ## sage/modules/misc.py

diff --git a/sage/modules/misc.py b/sage/modules/misc.py
 a could be.  Instead, see :meth:sage.matrix.matrix2.Matrix2.gram_schmidt which is safer and more general-purpose. EXAMPLES: EXAMPLES:: sage: B = [vector([1,2,1/5]), vector([1,2,3]), vector([-1,0,0])] sage: from sage.modules.misc import gram_schmidt
• ## sage/modules/quotient_module.py

diff --git a/sage/modules/quotient_module.py b/sage/modules/quotient_module.py
 a To obtain V or W use \code{self.V()} and \code{self.W()}. EXAMPLES: EXAMPLES:: sage: k. = QuadraticField(-1) sage: A = k^3; V = A.span([[1,0,i], [2,i,0]]) sage: W = A.span([[3,i,i]]) """ Create this quotient space, from the given domain, sub-module, and quotient_matrix. EXAMPLES: EXAMPLES:: sage: A = QQ^5; V = A.span_of_basis([[1,0,-1,1,1], [1,-1,0,2/3,3/4]]); V Vector space of degree 5 and dimension 2 over Rational Field User basis matrix: Return the rather verbose string representation of this quotient space V/W. EXAMPLES: We create a quotient vector space over a finite field: We create a quotient vector space over a finite field:: sage: k. = GF(9); A = k^3; V = A.span_of_basis([[1,0,a], [a,a,1]]); W = V.span([V.1]) sage: Q = V/W the tuple (V,W). EXAMPLES: We compute the hash of a certain 0-dimension quotient vector space: We compute the hash of a certain 0-dimension quotient vector space:: sage: A = QQ^2; V = A.span_of_basis([[1,0], [1,1]]); W = V.span([V.1, V.0]) sage: Q = V/W; Q.dimension() 0 self and other. EXAMPLES: We create three quotient spaces and compare them: We create three quotient spaces and compare them:: sage: A = QQ^2; V = A.span_of_basis([[1,0], [1,1]]); sage: W0 = V.span([V.1, V.0]); W1 = V.span([V.1]); W2 = V.span([V.1]) sage: Q0 = V/W0; Q1 = V/W1; Q2 = V/W2 if it can be made sense of as a list of length the dimension of self. EXAMPLES: We create a 2-dimensional quotient of a 3-dimension ambient vector space. We create a 2-dimensional quotient of a 3-dimension ambient vector space.:: sage: M = QQ^3 / [[1,2,3]] A list of length 3 coerces into QQ^3, so it coerces into M. Elements canonically coerce into self if they canonically coerce into V. EXAMPLES: EXAMPLES:: sage: V = QQ^3; W = V.span([[1,0,0]]); Q = V/W sage: Q._coerce_impl(V.0) (0, 0) """ Given this quotient space $Q = V/W$, return the natural quotient map from V to Q. EXAMPLES: EXAMPLES:: sage: M = QQ^3 / [[1,2,3]] sage: M.quotient_map() Vector space morphism represented by the matrix: Given this quotient space $Q = V/W$, return a fixed choice of linear homomorphism (a section) from Q to V. EXAMPLES: EXAMPLES:: sage: M = QQ^3 / [[1,2,3]] sage: M.lift_map() Vector space morphism represented by the matrix: The lift is a fixed homomorphism. EXAMPLES: EXAMPLES:: sage: M = QQ^3 / [[1,2,3]] sage: M.lift(M.0) (1, 0, 0) """ Given this quotient space $Q = V/W$, return W. EXAMPLES: EXAMPLES:: sage: M = QQ^10 / [range(10), range(2,12)] sage: M.W() Vector space of degree 10 and dimension 2 over Rational Field """ Given this quotient space $Q = V/W$, return $V$. EXAMPLES: EXAMPLES:: sage: M = QQ^10 / [range(10), range(2,12)] sage: M.V() Vector space of dimension 10 over Rational Field """ Given this quotient space $Q = V/W$, return $V$.  This is the same as self.V(). EXAMPLES: EXAMPLES:: sage: M = QQ^10 / [range(10), range(2,12)] sage: M.cover() Vector space of dimension 10 over Rational Field """ Given this quotient space $Q = V/W$, return $W$.  This is the same as self.W(). EXAMPLES: EXAMPLES:: sage: M = QQ^10 / [range(10), range(2,12)] sage: M.relations() Vector space of degree 10 and dimension 2 over Rational Field
• ## sage/monoids/string_ops.py

diff --git a/sage/monoids/string_ops.py b/sage/monoids/string_ops.py
 a def strip_encoding(S): """ The upper case string of S stripped of all non-alphabetic characters. EXAMPLES: EXAMPLES:: sage: S = "The cat in the hat." sage: strip_encoding(S) 'THECATINTHEHAT' def coincidence_index(S,n=1): """ The coincidence index of the string S. EXAMPLES: EXAMPLES:: sage: S = strip_encoding("The cat in the hat.") sage: coincidence_index(S) 0.120879120879121 Output: A measure of the difference of probability of association of character pairs, relative to their independent one-character probabilities. EXAMPLES: EXAMPLES:: sage: S = strip_encoding("The cat in the hat.") sage: coincidence_discriminant([ S[i:i+2] for i in range(len(S)-1) ]) 0.0827001855677322
• ## sage/plot/misc.py

diff --git a/sage/plot/misc.py b/sage/plot/misc.py
 a - A tuple of variables that were "free" in the functions EXAMPLES: EXAMPLES:: sage: x,y,z=var('x,y,z') sage: f(x,y)=x+y-z

diff --git a/sage/quadratic_forms/extras.py b/sage/quadratic_forms/extras.py
 a OUTPUT: either False or a non-negative integer EXAMPLES: EXAMPLES:: sage: is_triangular_number(3) 2 sage: is_triangular_number(1) OUTPUT: a square matrix, or a list of n vectors (resp.) EXAMPLES: EXAMPLES:: sage: A = Matrix(ZZ, 3, 2, range(6)) sage: extend_to_primitive(A) [ 0  1  0]

diff --git a/sage/quadratic_forms/genera/genus.py b/sage/quadratic_forms/genera/genus.py

diff --git a/sage/quadratic_forms/quadratic_form__local_field_invariants.py b/sage/quadratic_forms/quadratic_form__local_field_invariants.py
 a OUTPUT: an integer EXAMPLES: EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,0,0,-4,3,11,3]) sage: Q.signature() 3 OUTPUT: string describing the definiteness EXAMPLES: EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1,1]) sage: Q.compute_definiteness_string_by_determinants() 'pos_def'
• ## sage/rings/misc.py

diff --git a/sage/rings/misc.py b/sage/rings/misc.py
 a OUTPUT: field EXAMPLES: EXAMPLES:: sage: composite_field(QQ,QQbar) Algebraic Field sage: composite_field(QQ,QQ[sqrt(2)])
• ## sage/rings/number_field/totallyreal_phc.py

diff --git a/sage/rings/number_field/totallyreal_phc.py b/sage/rings/number_field/totallyreal_phc.py
 a AUTHORS: - John Voight (2007-09-19) EXAMPLES: EXAMPLES:: sage: sage.rings.number_field.totallyreal_phc.coefficients_to_power_sums(3,2,[1,5,7]) [3, -7, 39] sage: sage.rings.number_field.totallyreal_phc.coefficients_to_power_sums(5,4,[1,5,7,9,8]) AUTHORS: - John Voight (2007-09-19) EXAMPLES: EXAMPLES:: sage: from sage.rings.number_field.totallyreal_phc import __lagrange_bounds_phc sage: __lagrange_bounds_phc(3,5,[8,1,2,0,1]) # optional []
• ## sage/rings/pari_ring.py

diff --git a/sage/rings/pari_ring.py b/sage/rings/pari_ring.py
 a """ def __init__(self, x, parent=None): """ EXAMPLES: EXAMPLES:: sage: R = PariRing() sage: f = R('x^3 + 1/2') sage: f class PariRing(UniqueRepresentation, ring.Ring): """ EXAMPLES: EXAMPLES:: sage: R = PariRing(); R Pseudoring of all PARI objects. sage: loads(R.dumps()) is R
• ## sage/rings/tests.py

diff --git a/sage/rings/tests.py b/sage/rings/tests.py
 a OUTPUT: a prime finite field EXAMPLES: EXAMPLES:: sage: sage.rings.tests.prime_finite_field() Finite Field of size 64748301524082521489 """ OUTPUT: a finite field EXAMPLES: EXAMPLES:: sage: sage.rings.tests.finite_field() Finite Field in a of size 161123^4 """ OUTPUT: a finite field EXAMPLES: EXAMPLES:: sage: sage.rings.tests.small_finite_field() Finite Field of size 30029 """ """ Return a random ring of integers modulo n with n at most 50000. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.integer_mod_ring() Ring of integers modulo 30029 """ """ Return a quadratic extension of QQ. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.quadratic_number_field() Number Field in a with defining polynomial x^2 - 61099 """ """ Return an absolute extension of QQ of degree at most 10. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.absolute_number_field() Number Field in a with defining polynomial x^5 + 82*x^4 - 46*x^3 + 39*x^2 - x - 41 """ """ Return a tower of at most n extensions each of degree at most maxdeg. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.relative_number_field(3) Number Field in aaa with defining polynomial x^2 - 15*x + 17 over its base field """ - absolute number fields - relative number fields (disabled in the automatic tests for now) EXAMPLES: EXAMPLES:: sage: type(sage.rings.tests.rings0()) """ - polynomial ring over a rings1() ring. - multivariate polynomials EXAMPLES: EXAMPLES:: sage: type(sage.rings.tests.rings0()) """ """ Return an iterator over random rings up to the given "level" of complexity. EXAMPLES: EXAMPLES:: sage: type(sage.rings.tests.random_rings()) """ random seed. print_seed -- If True (default False), prints the random seed chosen. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.test_random_elements(trials=2, seed=0) survived 0 tests (memory usage = ...) Rational Field random seed. print_seed -- If True (default False), prints the random seed chosen. EXAMPLES: EXAMPLES:: sage: sage.rings.tests.test_random_arith(trials=2, seed=0) survived 0 tests (memory usage = ...) Rational Field
• ## sage/schemes/toric/weierstrass.py

diff --git a/sage/schemes/toric/weierstrass.py b/sage/schemes/toric/weierstrass.py
 a polynomial ring. A ValueError is raised if the polynomial is not homogeneous. EXAMPLES: EXAMPLES:: sage: from sage.schemes.toric.weierstrass import _check_polynomial_P2 sage: R. = QQ[] polynomial ring. A ValueError is raised if the polynomial is not homogeneous. EXAMPLES: EXAMPLES:: sage: from sage.schemes.toric.weierstrass import _check_polynomial_P1xP1 sage: R. = QQ[] polynomial ring. A ValueError is raised if the polynomial is not homogeneous. EXAMPLES: EXAMPLES:: sage: from sage.schemes.toric.weierstrass import _check_polynomial_P2_112 sage: R. = QQ[]
• ## sage/server/notebook/worksheet.py

diff --git a/sage/server/notebook/worksheet.py b/sage/server/notebook/worksheet.py
 a __internal_test1 = ''' def foo(x): " EXAMPLES: EXAMPLES:: sage: 2+2 4 "
• ## sage/structure/proof/all.py

diff --git a/sage/structure/proof/all.py b/sage/structure/proof/all.py
 a If t == False, allows integer arithmetic operations to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the integer arithmetic proof status. EXAMPLES: EXAMPLES:: sage: proof.arithmetic() True sage: proof.arithmetic(False) If t == False, allows elliptic curve algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current elliptic curve proof status. EXAMPLES: EXAMPLES:: sage: proof.elliptic_curve() True sage: proof.elliptic_curve(False) If t == False, allows linear algebra algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current linear algebra proof status. EXAMPLES: EXAMPLES:: sage: proof.linear_algebra() True sage: proof.linear_algebra(False) If t == False, allows number field algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current number field proof status. EXAMPLES: EXAMPLES:: sage: proof.number_field() True sage: proof.number_field(False) If t == False, allows polynomial algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current polynomial proof status. EXAMPLES: EXAMPLES:: sage: proof.polynomial() True sage: proof.polynomial(False) If t == False, allows Sage algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current global Sage proof status. EXAMPLES: EXAMPLES:: sage: proof.all() {'polynomial': True, 'other': True, 'elliptic_curve': True, 'number_field': True, 'linear_algebra': True, 'arithmetic': True} sage: proof.number_field(False)
• ## sage/structure/proof/proof.py

diff --git a/sage/structure/proof/proof.py b/sage/structure/proof/proof.py
 a If t == False, allows integer arithmetic operations to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the integer arithmetic proof status. EXAMPLES: EXAMPLES:: sage: proof.arithmetic() True sage: proof.arithmetic(False) If t == False, allows elliptic curve algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current elliptic curve proof status. EXAMPLES: EXAMPLES:: sage: proof.elliptic_curve() True sage: proof.elliptic_curve(False) If t == False, allows linear algebra algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current linear algebra proof status. EXAMPLES: EXAMPLES:: sage: proof.linear_algebra() True sage: proof.linear_algebra(False) If t == False, allows number field algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current number field proof status. EXAMPLES: EXAMPLES:: sage: proof.number_field() True sage: proof.number_field(False) If t == False, allows polynomial algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms.  Such algorithms often have a substantial speed improvement over those requiring proof. If t is None, returns the current polynomial proof status. EXAMPLES: EXAMPLES:: sage: proof.polynomial() True sage: proof.polynomial(False) """ Used for easily determining the correct proof flag to use. EXAMPLES: EXAMPLES:: sage: from sage.structure.proof.proof import get_flag sage: get_flag(False) False
• ## sage/tests/arxiv_0812_2725.py

diff --git a/sage/tests/arxiv_0812_2725.py b/sage/tests/arxiv_0812_2725.py
 a EXAMPLES: The example given in the paper. Note that in this format, we omit fixed points since they cannot create any sort of crossing. points since they cannot create any sort of crossing.:: sage: from sage.tests.arxiv_0812_2725 import * sage: dcrossing([(1,5), (2,4), (4,9), (6,12), (7,10), (10,11)]) 2-element tuples. EXAMPLES: There are 3 complete matchings on 4 vertices: There are 3 complete matchings on 4 vertices:: sage: from sage.tests.arxiv_0812_2725 import * sage: [m for m in CompleteMatchings(4)] [[(3, 4), (1, 2)], [(2, 4), (1, 3)], [(2, 3), (1, 4)]] of L and vertices are labeled by elements of L. Each matching is represented by a list of 2-element tuples. EXAMPLES: EXAMPLES:: sage: from sage.tests.arxiv_0812_2725 import * sage: [m for m in matchingsset(('a', 'b', 'c', 'd'))] [[('c', 'd'), ('a', 'b')], [('b', 'd'), ('a', 'c')], [('b', 'c'), ('a', 'd')]] Matchings and set partitions with no crossings at all yield -1. EXAMPLES: The main example from the paper: The main example from the paper:: sage: from sage.tests.arxiv_0812_2725 import * sage: dcrossing(setp_to_edges(Set(map(Set, [[1,5],[2,4,9],[3],[6,12],[7,10,11],[8]])))) 3 d-noncrossing. Because of this, you should not think of the last element of the list as having index n-1, but rather -1. EXAMPLES: EXAMPLES:: sage: from sage.tests.arxiv_0812_2725 import * sage: dcrossvec_setp(3) [1, 0, 4] EXAMPLES: The single complete matching on 2 vertices has no crossings, so the only nonzero entry of the list (the last entry) is 1: only nonzero entry of the list (the last entry) is 1:: sage: from sage.tests.arxiv_0812_2725 import * sage: dcrossvec_cm(2) [0, 1] probably don't need this function to work through n = 1. EXAMPLES: Complete matchings: Complete matchings:: sage: from sage.tests.arxiv_0812_2725 import * sage: tablecolumn(2, 1) [1]