# Ticket #4539: plural-missing-docu.2.patch

File plural-missing-docu.2.patch, 21.0 KB (added by AlexanderDreyer, 7 years ago)
• ## sage/algebras/free_algebra.py

diff -r 6a696ae732ab sage/algebras/free_algebra.py
 a """ def __init__(self, R, n, names): """ The free algebra on n generators over a base ring. INPUT: -  R - ring -  n - an integer -  names - generator names EXAMPLES:: sage: F. = FreeAlgebra(QQ, 3); F # indirect doctet Free Algebra on 3 generators (x, y, z) over Rational Field """ if not isinstance(R, Ring): raise TypeError, "Argument R must be a ring." sage: print F Free Algebra on 3 generators (x0, x1, x2) over Rational Field sage: F.rename('QQ<>') sage: print F sage: print F #indirect doctest QQ<> """ return "Free Algebra on %s generators %s over %s"%( :: sage: F._coerce_(x*y) sage: F._coerce_(x*y) # indirect doctest x*y Elements of the integers coerce in, since there is a coerce map return self._coerce_try(x, [self.base_ring()]) def coerce_map_from_impl(self, R): """ Elements of the free algebra canonically coerce in. EXAMPLES:: sage: F. = FreeAlgebra(GF(7),3); F Free Algebra on 3 generators (x, y, z) over Finite Field of size 7 sage: F._coerce_(x*y) # indirect doctest x*y """ if R is self.__monoid: return True which form a free basis for the module of A, and a list of matrices, which give the action of the free generators of A on this monomial basis. Quaternion algebra defined in terms of three generators:: sage: n = 3 sage: A = FreeAlgebra(QQ,n,'i') sage: F = A.monoid() sage: i, j, k = F.gens() sage: mons = [ F(1), i, j, k ] sage: M = MatrixSpace(QQ,4) sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]),  M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]),  M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]) ] sage: H. = A.quotient(mons, mats); H Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 over Rational Field """ import free_algebra_quotient return free_algebra_quotient.FreeAlgebraQuotient(self, mons, mats, names)
• ## sage/libs/singular/function.pyx

diff -r 6a696ae732ab sage/libs/singular/function.pyx
 a self._ring.ref -= 1 def ngens(self): """ Get number of generators EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).ngens() 3 """ return self._ring.N def var_names(self): """ Get name of variables EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).var_names() ['x', 'y', 'z'] """ return [self._ring.names[i] for i in range(self.ngens())] def npars(self): """ Get number of parameters EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).npars() 0 """ return self._ring.P def ordering_string(self): """ Get Singular string defining monomial ordering EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).ordering_string() 'dp(3),C' """ return rOrderingString(self._ring) def par_names(self): """ Get parameter names EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).par_names() [] """ return [self._ring.parameter[i] for i in range(self.npars())] def characteristic(self): """ Get characteristic EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).characteristic() 0 """ return self._ring.ch def is_commutative(self): """ Determine whether a given ring is  commutative EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P).is_commutative() True """ return not rIsPluralRing(self._ring) def _output(self): # , debug = False """ Use Singular output EXAMPLE:: sage: from sage.libs.singular.function import singular_function sage: P. = PolynomialRing(QQ) sage: ringlist = singular_function("ringlist") sage: l = ringlist(P) sage: ring = singular_function("ring") sage: ring(l, ring=P)._output() """ rPrint(self._ring) #        if debug: #        rDebugPrint(self._ring) # ===================================== def is_sage_wrapper_for_singular_ring(ring): """ Check whether wrapped ring arises from Singular or Singular/Plural EXAMPLE:: sage: from sage.libs.singular.function import is_sage_wrapper_for_singular_ring sage: P. = QQ[] sage: is_sage_wrapper_for_singular_ring(P) True sage: A. = FreeAlgebra(QQ, 3) sage: P = A.g_algebra(relations={y*x:-x*y}, order = 'lex') sage: is_sage_wrapper_for_singular_ring(P) True """ if PY_TYPE_CHECK(ring, MPolynomialRing_libsingular): return True if PY_TYPE_CHECK(ring, NCPolynomialRing_plural): sage: len(l) 6 sage: ring(l, ring=P) sage: I=twostd(I) sage: l[3]=I sage: ring(l, ring=P) """
• ## sage/rings/polynomial/multi_polynomial_ideal.py

diff -r 6a696ae732ab sage/rings/polynomial/multi_polynomial_ideal.py
 a sage: P. = PolynomialRing(GF(127)) sage: J = sage.rings.ideal.Cyclic(P).homogenize() sage: from sage.misc.sageinspect import sage_getsource sage: "buchberger" in sage_getsource(J.interreduced_basis) sage: "buchberger" in sage_getsource(J.interreduced_basis) #indirect doctest True .. note:: EXAMPLES:: sage: R. = PolynomialRing(GF(127),10) sage: I = sage.rings.ideal.Cyclic(R,4) sage: magma(I)                                          # optional - magma sage: I = sage.rings.ideal.Cyclic(R,4) # indirect doctest sage: magma(I)    # optional - magma Ideal of Polynomial ring of rank 10 over GF(127) Graded Reverse Lexicographical Order Variables: a, b, c, d, e, f, g, h, i, j return S class MPolynomialIdeal_singular_commutative_repr( class MPolynomialIdeal_singular_repr( MPolynomialIdeal_singular_base_repr): """ An ideal in a multivariate polynomial ring, which has an False """ R = self.ring() if not isinstance(other, MPolynomialIdeal_singular_repr) or other.ring() != R: raise ValueError, "other must be an ideal in the ring of self, but it isn't." def _macaulay2_(self, macaulay2=None): """ Return Macaulay2 ideal corresponding to this ideal. EXAMPLES:: sage: R. = PolynomialRing(ZZ, 4) sage: I = ideal(x*y-z^2, y^2-w^2)  #indirect doctest sage: macaulay2(I) # optional - macaulay2 Ideal (x*y - z^2, y^2 - w^2) of Multivariate Polynomial Ring in x, y, z, w over Integer Ring """ if macaulay2 is None: macaulay2 = macaulay2_default try: R = self.ring() return R(k) class NCPolynomialIdeal(MPolynomialIdeal_singular_base_repr, Ideal_generic): class NCPolynomialIdeal(MPolynomialIdeal_singular_repr, Ideal_generic): def __init__(self, ring, gens, coerce=True): r""" Computes a non-commutative ideal. EXAMPLES:: sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) # indirect doctest """ Ideal_generic.__init__(self, ring, gens, coerce=coerce) def __call_singular(self, cmd, arg = None): """ Internal function for calling a Singular function INPUTS: - cmd - string, representing a Singular function - arg (Default: None) - arguments for which cmd is called OUTPUTS: - result of the Singular function call EXAMPLES:: sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: id = H.ideal(x + y, y + z) sage: id.std()  # indirect doctest Ideal (z, y, x) of Noncommutative Multivariate Polynomial Ring in x, y, z over Rational Field, nc-relations: {y*x: x*y - z, z*y: y*z - 2*y, z*x: x*z + 2*x} """ from sage.libs.singular.function import singular_function fun = singular_function(cmd) if arg is None: r""" Computes a left GB of the ideal. EXAMPLE:: EXAMPLES:: sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) sage: I.std() Ideal (z^2 - 1, y*z - y, x*z + x, y^2, 2*x*y - z - 1, x^2) of Noncommutative Multivariate Polynomial Ring in x, y, z over Rational Field... r""" Computes a two-sided GB of the ideal. EXAMPLE:: EXAMPLES:: sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) sage: I.twostd() Ideal (z^2 - 1, y*z - y, x*z + x, y^2, 2*x*y - z - 1, x^2) of Noncommutative Multivariate Polynomial Ring in x, y, z over Rational Field... sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) sage: G = vector(I.gens()); G ... sage: G = vector(I.gens()); G doctest:357: UserWarning: You are constructing a free module   over a noncommutative ring. Sage does not have a concept of left/right and both sided modules be careful. It's also not guarantied that all multiplications are done from the right side. doctest:573: UserWarning: You are constructing a free module over a noncommutative ring. Sage does not have a concept of left/right and both sided modules be careful. It's also not guarantied that all multiplications are done from the right side. (y^2, x^2, z^2 - 1) sage: M = I.syzygy_module(); M ... sage: (G.transpose() * M.transpose()).transpose() (0, 0) [                                                                         -z^2 - 8*z - 15                                                                                        0                                                                                      y^2] [                                                                                       0                                                                          -z^2 + 8*z - 15                                                                                      x^2] [                                                              x^2*z^2 + 8*x^2*z + 15*x^2                                                              -y^2*z^2 + 8*y^2*z - 15*y^2                                                                   -4*x*y*z + 2*z^2 + 2*z] [                 x^2*y*z^2 + 9*x^2*y*z - 6*x*z^3 + 20*x^2*y - 72*x*z^2 - 282*x*z - 360*x                                                              -y^3*z^2 + 7*y^3*z - 12*y^3                                                                                  6*y*z^2] [                                                              x^3*z^2 + 7*x^3*z + 12*x^3                 -x*y^2*z^2 + 9*x*y^2*z - 4*y*z^3 - 20*x*y^2 + 52*y*z^2 - 224*y*z + 320*y                                                                                 -6*x*z^2] [  x^2*y^2*z + 4*x^2*y^2 - 8*x*y*z^2 - 48*x*y*z + 12*z^3 - 64*x*y + 108*z^2 + 312*z + 288                                                                           -y^4*z + 4*y^4                                                                                        0] [                                                  2*x^3*y*z + 8*x^3*y + 9*x^2*z + 27*x^2                                   -2*x*y^3*z + 8*x*y^3 - 12*y^2*z^2 + 99*y^2*z - 195*y^2                                                                -36*x*y*z + 24*z^2 + 18*z] [                                                  2*x^3*y*z + 8*x^3*y + 9*x^2*z + 27*x^2                                   -2*x*y^3*z + 8*x*y^3 - 12*y^2*z^2 + 99*y^2*z - 195*y^2                                                                -36*x*y*z + 24*z^2 + 18*z] [                                                                           x^4*z + 4*x^4    -x^2*y^2*z + 4*x^2*y^2 - 4*x*y*z^2 + 32*x*y*z - 6*z^3 - 64*x*y + 66*z^2 - 240*z + 288                                                                                        0] [x^3*y^2*z + 4*x^3*y^2 + 18*x^2*y*z - 36*x*z^3 + 66*x^2*y - 432*x*z^2 - 1656*x*z - 2052*x                                      -x*y^4*z + 4*x*y^4 - 8*y^3*z^2 + 62*y^3*z - 114*y^3                                                                        48*y*z^2 - 36*y*z] sage: M*G (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ALGORITHM: Uses Singular's syz command """ return matrix(self.ring(), S) def res(length): def res(self, length): r""" Computes the first syzygy (i.e., the module of relations of the given generators) of the ideal. EXAMPLE:: sage: A. = FreeAlgebra(QQ, 3) sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) sage: H.inject_variables() Defining x, y, z sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) sage: I.res(3) """ return self.__call_singular('res', length) class MPolynomialIdeal( MPolynomialIdeal_singular_commutative_repr, \ class MPolynomialIdeal( MPolynomialIdeal_singular_repr, \ MPolynomialIdeal_macaulay2_repr, \ MPolynomialIdeal_magma_repr, \ Ideal_generic ): sage: R. = PolynomialRing(QQ) sage: I = R.ideal(x^2-2*x*z+5, x*y^2+y*z+1, 3*y^2-8*x*z) sage: I.normal_basis() sage: I.normal_basis() #indirect doctest [z^2, y*z, x*z, z, x*y, y, x, 1] """ from sage.rings.polynomial.multi_polynomial_ideal_libsingular import kbase_libsingular
• ## sage/rings/polynomial/multi_polynomial_libsingular.pyx

diff -r 6a696ae732ab sage/rings/polynomial/multi_polynomial_libsingular.pyx
 a EXAMPLES:: sage: P.=PolynomialRing(QQ,3) sage: 3/2*x + 1/2*y + 1 sage: 3/2*x + 1/2*y + 1 #indirect doctest 3/2*x + 1/2*y + 1 """ EXAMPLES:: sage: P.=PolynomialRing(QQ,3) sage: 3/2*x - 1/2*y - 1 sage: 3/2*x - 1/2*y - 1 #indirect doctest 3/2*x - 1/2*y - 1 """ EXAMPLES:: sage: P.=PolynomialRing(QQ,3) sage: 3/2*x sage: 3/2*x # indirect doctest 3/2*x """ return new_MP((self._parent),_p) cpdef ModuleElement _lmul_(self, RingElement right): # all currently implemented rings are commutative return self._rmul_(right) """ Multiply left and right. EXAMPLES:: sage: P.=PolynomialRing(QQ,3) sage: (3/2*x - 1/2*y - 1) * (3/2) # indirect doctest 9/4*x - 3/4*y - 3/2 """ # all currently implemented baser rings are commutative return right._rmul_(self) cpdef RingElement  _mul_(left, RingElement right): """ EXAMPLES:: sage: P.=PolynomialRing(QQ,3) sage: (3/2*x - 1/2*y - 1) * (3/2*x + 1/2*y + 1) sage: (3/2*x - 1/2*y - 1) * (3/2*x + 1/2*y + 1) # indirect doctest 9/4*x^2 - 1/4*y^2 - y - 1 sage: P. = PolynomialRing(QQ,order='lex') EXAMPLES:: sage: R.=PolynomialRing(QQ,2) sage: f = (x + y)/3 sage: f = (x + y)/3 # indirect doctest sage: f.parent() Multivariate Polynomial Ring in x, y over Rational Field sage: P. = QQ[] sage: f = - 1*x^2*y - 25/27 * y^3 - z^2 sage: latex(f) sage: latex(f)  # indirect doctest - x^{2} y - \frac{25}{27} y^{3} - z^{2} """ cdef ring *_ring = (self._parent)._ring EXAMPLES:: sage: R. = PolynomialRing(GF(7), 2) sage: f = (x^3 + 2*y^2*x)^7; f sage: f = (x^3 + 2*y^2*x)^7; f          # indirect doctest x^21 + 2*x^7*y^14 sage: h = macaulay2(f); h               # optional