Ticket #4539: plural-missing-docu.2.patch
| File plural-missing-docu.2.patch, 21.0 KB (added by AlexanderDreyer, 3 years ago) |
|---|
-
sage/algebras/free_algebra.py
diff -r 6a696ae732ab sage/algebras/free_algebra.py
a b 166 166 """ 167 167 def __init__(self, R, n, names): 168 168 """ 169 The free algebra on `n` generators over a base ring. 169 170 INPUT: 170 171 171 172 172 - ``R`` - ring 173 173 174 174 - ``n`` - an integer 175 175 176 176 - ``names`` - generator names 177 178 EXAMPLES:: 179 180 sage: F.<x,y,z> = FreeAlgebra(QQ, 3); F # indirect doctet 181 Free Algebra on 3 generators (x, y, z) over Rational Field 177 182 """ 178 183 if not isinstance(R, Ring): 179 184 raise TypeError, "Argument R must be a ring." … … 253 258 sage: print F 254 259 Free Algebra on 3 generators (x0, x1, x2) over Rational Field 255 260 sage: F.rename('QQ<<x0,x1,x2>>') 256 sage: print F 261 sage: print F #indirect doctest 257 262 QQ<<x0,x1,x2>> 258 263 """ 259 264 return "Free Algebra on %s generators %s over %s"%( … … 312 317 313 318 :: 314 319 315 sage: F._coerce_(x*y) 320 sage: F._coerce_(x*y) # indirect doctest 316 321 x*y 317 322 318 323 Elements of the integers coerce in, since there is a coerce map … … 383 388 return self._coerce_try(x, [self.base_ring()]) 384 389 385 390 def coerce_map_from_impl(self, R): 391 """ 392 Elements of the free algebra canonically coerce in. 393 394 EXAMPLES:: 395 396 sage: F.<x,y,z> = FreeAlgebra(GF(7),3); F 397 Free Algebra on 3 generators (x, y, z) over Finite Field of size 7 398 399 sage: F._coerce_(x*y) # indirect doctest 400 x*y 401 """ 402 386 403 if R is self.__monoid: 387 404 return True 388 405 … … 421 438 which form a free basis for the module of A, and a list of 422 439 matrices, which give the action of the free generators of A on this 423 440 monomial basis. 441 Quaternion algebra defined in terms of three generators:: 442 443 sage: n = 3 444 sage: A = FreeAlgebra(QQ,n,'i') 445 sage: F = A.monoid() 446 sage: i, j, k = F.gens() 447 sage: mons = [ F(1), i, j, k ] 448 sage: M = MatrixSpace(QQ,4) 449 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]) ] 450 sage: H.<i,j,k> = A.quotient(mons, mats); H 451 Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 over Rational Field 424 452 """ 425 453 import free_algebra_quotient 426 454 return free_algebra_quotient.FreeAlgebraQuotient(self, mons, mats, names) -
sage/libs/singular/function.pyx
diff -r 6a696ae732ab sage/libs/singular/function.pyx
a b 158 158 self._ring.ref -= 1 159 159 160 160 def ngens(self): 161 """ 162 Get number of generators 163 164 EXAMPLE:: 165 166 sage: from sage.libs.singular.function import singular_function 167 sage: P.<x,y,z> = PolynomialRing(QQ) 168 sage: ringlist = singular_function("ringlist") 169 sage: l = ringlist(P) 170 sage: ring = singular_function("ring") 171 sage: ring(l, ring=P).ngens() 172 3 173 """ 161 174 return self._ring.N 162 175 163 176 def var_names(self): 177 """ 178 Get name of variables 179 180 EXAMPLE:: 181 182 sage: from sage.libs.singular.function import singular_function 183 sage: P.<x,y,z> = PolynomialRing(QQ) 184 sage: ringlist = singular_function("ringlist") 185 sage: l = ringlist(P) 186 sage: ring = singular_function("ring") 187 sage: ring(l, ring=P).var_names() 188 ['x', 'y', 'z'] 189 """ 164 190 return [self._ring.names[i] for i in range(self.ngens())] 165 191 166 192 def npars(self): 193 """ 194 Get number of parameters 195 196 EXAMPLE:: 197 198 sage: from sage.libs.singular.function import singular_function 199 sage: P.<x,y,z> = PolynomialRing(QQ) 200 sage: ringlist = singular_function("ringlist") 201 sage: l = ringlist(P) 202 sage: ring = singular_function("ring") 203 sage: ring(l, ring=P).npars() 204 0 205 """ 167 206 return self._ring.P 168 207 169 208 def ordering_string(self): 209 """ 210 Get Singular string defining monomial ordering 211 212 EXAMPLE:: 213 214 sage: from sage.libs.singular.function import singular_function 215 sage: P.<x,y,z> = PolynomialRing(QQ) 216 sage: ringlist = singular_function("ringlist") 217 sage: l = ringlist(P) 218 sage: ring = singular_function("ring") 219 sage: ring(l, ring=P).ordering_string() 220 'dp(3),C' 221 """ 170 222 return rOrderingString(self._ring) 171 223 172 224 173 225 174 226 def par_names(self): 227 """ 228 Get parameter names 229 230 EXAMPLE:: 231 232 sage: from sage.libs.singular.function import singular_function 233 sage: P.<x,y,z> = PolynomialRing(QQ) 234 sage: ringlist = singular_function("ringlist") 235 sage: l = ringlist(P) 236 sage: ring = singular_function("ring") 237 sage: ring(l, ring=P).par_names() 238 [] 239 """ 175 240 return [self._ring.parameter[i] for i in range(self.npars())] 176 241 177 242 def characteristic(self): 243 """ 244 Get characteristic 245 246 EXAMPLE:: 247 248 sage: from sage.libs.singular.function import singular_function 249 sage: P.<x,y,z> = PolynomialRing(QQ) 250 sage: ringlist = singular_function("ringlist") 251 sage: l = ringlist(P) 252 sage: ring = singular_function("ring") 253 sage: ring(l, ring=P).characteristic() 254 0 255 """ 178 256 return self._ring.ch 179 257 180 258 def is_commutative(self): 259 """ 260 Determine whether a given ring is commutative 261 262 EXAMPLE:: 263 264 sage: from sage.libs.singular.function import singular_function 265 sage: P.<x,y,z> = PolynomialRing(QQ) 266 sage: ringlist = singular_function("ringlist") 267 sage: l = ringlist(P) 268 sage: ring = singular_function("ring") 269 sage: ring(l, ring=P).is_commutative() 270 True 271 """ 181 272 return not rIsPluralRing(self._ring) 182 273 183 274 def _output(self): # , debug = False 275 """ 276 Use Singular output 277 278 EXAMPLE:: 279 280 sage: from sage.libs.singular.function import singular_function 281 sage: P.<x,y,z> = PolynomialRing(QQ) 282 sage: ringlist = singular_function("ringlist") 283 sage: l = ringlist(P) 284 sage: ring = singular_function("ring") 285 sage: ring(l, ring=P)._output() 286 """ 184 287 rPrint(self._ring) 185 288 # if debug: 186 289 # rDebugPrint(self._ring) … … 266 369 # ===================================== 267 370 268 371 def is_sage_wrapper_for_singular_ring(ring): 372 """ 373 Check whether wrapped ring arises from Singular or Singular/Plural 374 375 EXAMPLE:: 376 377 sage: from sage.libs.singular.function import is_sage_wrapper_for_singular_ring 378 sage: P.<x,y,z> = QQ[] 379 sage: is_sage_wrapper_for_singular_ring(P) 380 True 381 382 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 383 sage: P = A.g_algebra(relations={y*x:-x*y}, order = 'lex') 384 sage: is_sage_wrapper_for_singular_ring(P) 385 True 386 387 """ 269 388 if PY_TYPE_CHECK(ring, MPolynomialRing_libsingular): 270 389 return True 271 390 if PY_TYPE_CHECK(ring, NCPolynomialRing_plural): … … 1527 1646 sage: len(l) 1528 1647 6 1529 1648 sage: ring(l, ring=P) 1530 < RingWrap>1649 <noncommutative RingWrap> 1531 1650 sage: I=twostd(I) 1532 1651 sage: l[3]=I 1533 1652 sage: ring(l, ring=P) 1534 < RingWrap>1653 <noncommutative RingWrap> 1535 1654 1536 1655 """ 1537 1656 -
sage/rings/polynomial/multi_polynomial_ideal.py
diff -r 6a696ae732ab sage/rings/polynomial/multi_polynomial_ideal.py
a b 353 353 sage: P.<a,b,c,d,e> = PolynomialRing(GF(127)) 354 354 sage: J = sage.rings.ideal.Cyclic(P).homogenize() 355 355 sage: from sage.misc.sageinspect import sage_getsource 356 sage: "buchberger" in sage_getsource(J.interreduced_basis) 356 sage: "buchberger" in sage_getsource(J.interreduced_basis) #indirect doctest 357 357 True 358 358 359 359 .. note:: … … 451 451 EXAMPLES:: 452 452 453 453 sage: R.<a,b,c,d,e,f,g,h,i,j> = PolynomialRing(GF(127),10) 454 sage: I = sage.rings.ideal.Cyclic(R,4) 455 sage: magma(I) # optional - magma454 sage: I = sage.rings.ideal.Cyclic(R,4) # indirect doctest 455 sage: magma(I) # optional - magma 456 456 Ideal of Polynomial ring of rank 10 over GF(127) 457 457 Graded Reverse Lexicographical Order 458 458 Variables: a, b, c, d, e, f, g, h, i, j … … 604 604 return S 605 605 606 606 607 class MPolynomialIdeal_singular_ commutative_repr(607 class MPolynomialIdeal_singular_repr( 608 608 MPolynomialIdeal_singular_base_repr): 609 609 """ 610 610 An ideal in a multivariate polynomial ring, which has an … … 1349 1349 False 1350 1350 """ 1351 1351 R = self.ring() 1352 1352 1353 if not isinstance(other, MPolynomialIdeal_singular_repr) or other.ring() != R: 1353 1354 raise ValueError, "other must be an ideal in the ring of self, but it isn't." 1354 1355 … … 2196 2197 def _macaulay2_(self, macaulay2=None): 2197 2198 """ 2198 2199 Return Macaulay2 ideal corresponding to this ideal. 2200 EXAMPLES:: 2201 2202 sage: R.<x,y,z,w> = PolynomialRing(ZZ, 4) 2203 sage: I = ideal(x*y-z^2, y^2-w^2) #indirect doctest 2204 sage: macaulay2(I) # optional - macaulay2 2205 Ideal (x*y - z^2, y^2 - w^2) of Multivariate Polynomial Ring in x, y, z, w over Integer Ring 2199 2206 """ 2200 2207 if macaulay2 is None: macaulay2 = macaulay2_default 2201 2208 try: … … 2274 2281 R = self.ring() 2275 2282 return R(k) 2276 2283 2277 class NCPolynomialIdeal(MPolynomialIdeal_singular_ base_repr, Ideal_generic):2284 class NCPolynomialIdeal(MPolynomialIdeal_singular_repr, Ideal_generic): 2278 2285 def __init__(self, ring, gens, coerce=True): 2286 r""" 2287 Computes a non-commutative ideal. 2288 2289 EXAMPLES:: 2290 2291 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2292 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2293 sage: H.inject_variables() 2294 Defining x, y, z 2295 2296 sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) # indirect doctest 2297 """ 2279 2298 Ideal_generic.__init__(self, ring, gens, coerce=coerce) 2280 2299 2281 2300 def __call_singular(self, cmd, arg = None): 2301 """ 2302 Internal function for calling a Singular function 2303 2304 INPUTS: 2305 2306 - ``cmd`` - string, representing a Singular function 2307 2308 - ``arg`` (Default: None) - arguments for which cmd is called 2309 2310 OUTPUTS: 2311 2312 - result of the Singular function call 2313 2314 EXAMPLES:: 2315 2316 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2317 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2318 sage: H.inject_variables() 2319 Defining x, y, z 2320 sage: id = H.ideal(x + y, y + z) 2321 sage: id.std() # indirect doctest 2322 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} 2323 """ 2282 2324 from sage.libs.singular.function import singular_function 2283 2325 fun = singular_function(cmd) 2284 2326 if arg is None: … … 2290 2332 r""" 2291 2333 Computes a left GB of the ideal. 2292 2334 2293 EXAMPLE ::2335 EXAMPLES:: 2294 2336 2295 2337 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2296 2338 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2297 2339 sage: H.inject_variables() 2340 Defining x, y, z 2298 2341 sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) 2299 2342 sage: I.std() 2300 2343 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... … … 2308 2351 r""" 2309 2352 Computes a two-sided GB of the ideal. 2310 2353 2311 EXAMPLE ::2354 EXAMPLES:: 2312 2355 2313 2356 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2314 2357 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2315 2358 sage: H.inject_variables() 2359 Defining x, y, z 2316 2360 sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) 2317 2361 sage: I.twostd() 2318 2362 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... … … 2336 2380 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2337 2381 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2338 2382 sage: H.inject_variables() 2383 Defining x, y, z 2339 2384 sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) 2340 sage: G = vector(I.gens()); G 2341 ... 2385 sage: G = vector(I.gens()); G 2386 doctest:357: UserWarning: You are constructing a free module over a noncommutative ring. Sage does 2387 not have a concept of left/right and both sided modules be careful. It's also 2388 not guarantied that all multiplications are done from the right side. 2389 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. 2342 2390 (y^2, x^2, z^2 - 1) 2343 2391 sage: M = I.syzygy_module(); M 2344 ... 2345 sage: (G.transpose() * M.transpose()).transpose() 2346 (0, 0) 2392 [ -z^2 - 8*z - 15 0 y^2] 2393 [ 0 -z^2 + 8*z - 15 x^2] 2394 [ 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] 2395 [ 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] 2396 [ 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] 2397 [ 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] 2398 [ 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] 2399 [ 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] 2400 [ 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] 2401 [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] 2402 2403 sage: M*G 2404 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 2347 2405 2348 2406 ALGORITHM: Uses Singular's syz command 2349 2407 """ … … 2356 2414 return matrix(self.ring(), S) 2357 2415 2358 2416 2359 def res(length): 2417 def res(self, length): 2418 r""" 2419 Computes the first syzygy (i.e., the module of relations of the 2420 given generators) of the ideal. 2421 2422 EXAMPLE:: 2423 2424 sage: A.<x,y,z> = FreeAlgebra(QQ, 3) 2425 sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) 2426 sage: H.inject_variables() 2427 Defining x, y, z 2428 sage: I = H.ideal([y^2, x^2, z^2-H.one_element()],coerce=False) 2429 sage: I.res(3) 2430 <Resolution> 2431 """ 2360 2432 return self.__call_singular('res', length) 2361 2433 2362 2434 2363 class MPolynomialIdeal( MPolynomialIdeal_singular_ commutative_repr, \2435 class MPolynomialIdeal( MPolynomialIdeal_singular_repr, \ 2364 2436 MPolynomialIdeal_macaulay2_repr, \ 2365 2437 MPolynomialIdeal_magma_repr, \ 2366 2438 Ideal_generic ): … … 2980 3052 2981 3053 sage: R.<x,y,z> = PolynomialRing(QQ) 2982 3054 sage: I = R.ideal(x^2-2*x*z+5, x*y^2+y*z+1, 3*y^2-8*x*z) 2983 sage: I.normal_basis() 3055 sage: I.normal_basis() #indirect doctest 2984 3056 [z^2, y*z, x*z, z, x*y, y, x, 1] 2985 3057 """ 2986 3058 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 b 1880 1880 EXAMPLES:: 1881 1881 1882 1882 sage: P.<x,y,z>=PolynomialRing(QQ,3) 1883 sage: 3/2*x + 1/2*y + 1 1883 sage: 3/2*x + 1/2*y + 1 #indirect doctest 1884 1884 3/2*x + 1/2*y + 1 1885 1885 1886 1886 """ … … 1897 1897 EXAMPLES:: 1898 1898 1899 1899 sage: P.<x,y,z>=PolynomialRing(QQ,3) 1900 sage: 3/2*x - 1/2*y - 1 1900 sage: 3/2*x - 1/2*y - 1 #indirect doctest 1901 1901 3/2*x - 1/2*y - 1 1902 1902 1903 1903 """ … … 1916 1916 EXAMPLES:: 1917 1917 1918 1918 sage: P.<x,y,z>=PolynomialRing(QQ,3) 1919 sage: 3/2*x 1919 sage: 3/2*x # indirect doctest 1920 1920 3/2*x 1921 1921 """ 1922 1922 … … 1928 1928 return new_MP((<MPolynomialRing_libsingular>self._parent),_p) 1929 1929 1930 1930 cpdef ModuleElement _lmul_(self, RingElement right): 1931 # all currently implemented rings are commutative 1932 return self._rmul_(right) 1931 """ 1932 Multiply left and right. 1933 1934 EXAMPLES:: 1935 1936 sage: P.<x,y,z>=PolynomialRing(QQ,3) 1937 sage: (3/2*x - 1/2*y - 1) * (3/2) # indirect doctest 1938 9/4*x - 3/4*y - 3/2 1939 """ 1940 # all currently implemented baser rings are commutative 1941 return right._rmul_(self) 1933 1942 1934 1943 cpdef RingElement _mul_(left, RingElement right): 1935 1944 """ … … 1938 1947 EXAMPLES:: 1939 1948 1940 1949 sage: P.<x,y,z>=PolynomialRing(QQ,3) 1941 sage: (3/2*x - 1/2*y - 1) * (3/2*x + 1/2*y + 1) 1950 sage: (3/2*x - 1/2*y - 1) * (3/2*x + 1/2*y + 1) # indirect doctest 1942 1951 9/4*x^2 - 1/4*y^2 - y - 1 1943 1952 1944 1953 sage: P.<x,y> = PolynomialRing(QQ,order='lex') … … 1961 1970 EXAMPLES:: 1962 1971 1963 1972 sage: R.<x,y>=PolynomialRing(QQ,2) 1964 sage: f = (x + y)/3 1973 sage: f = (x + y)/3 # indirect doctest 1965 1974 sage: f.parent() 1966 1975 Multivariate Polynomial Ring in x, y over Rational Field 1967 1976 … … 2137 2146 2138 2147 sage: P.<x,y,z> = QQ[] 2139 2148 sage: f = - 1*x^2*y - 25/27 * y^3 - z^2 2140 sage: latex(f) 2149 sage: latex(f) # indirect doctest 2141 2150 - x^{2} y - \frac{25}{27} y^{3} - z^{2} 2142 2151 """ 2143 2152 cdef ring *_ring = (<MPolynomialRing_libsingular>self._parent)._ring … … 4096 4105 EXAMPLES:: 4097 4106 4098 4107 sage: R.<x,y> = PolynomialRing(GF(7), 2) 4099 sage: f = (x^3 + 2*y^2*x)^7; f 4108 sage: f = (x^3 + 2*y^2*x)^7; f # indirect doctest 4100 4109 x^21 + 2*x^7*y^14 4101 4110 4102 4111 sage: h = macaulay2(f); h # optional
