Ticket #7457: trac_7457.patch
File trac_7457.patch, 9.2 KB (added by , 13 years ago) |
---|
-
sage/rings/polynomial/infinite_polynomial_ring.py
# HG changeset patch # User Alexandru Ghitza <aghitza@alum.mit.edu> # Date 1258201015 -39600 # Node ID ea85928b75aaf287aae21ab7d7a6aa1fa51e1ead # Parent 5db805d3bdafb3f79835cff2af6a333f749b500c trac 7457: improvements to quotient_ring.py diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/polynomial/infinite_polynomial_ring.py
a b 534 534 """ 535 535 return self._base.characteristic() 536 536 537 def is_field(self): 538 """ 539 Return ``False``, since polynomial rings in infinitely many 540 variables are never fields. 541 542 EXAMPLES:: 543 544 sage: R.<x, y> = InfinitePolynomialRing(QQ) 545 sage: R.is_field() 546 False 547 """ 548 return False 549 550 def is_integral_domain(self): 551 """ 552 Return ``True``, since polynomial rings in infinitely many 553 variables over a field are always integral domains. 554 555 EXAMPLES:: 556 557 sage: R.<x, y> = InfinitePolynomialRing(QQ) 558 sage: R.is_integral_domain() 559 True 560 """ 561 return True 562 563 def is_noetherian(self): 564 """ 565 Return ``False``, since polynomial rings in infinitely many 566 variables are never Noetherian. 567 568 EXAMPLES:: 569 570 sage: R.<x> = InfinitePolynomialRing(QQ) 571 sage: R.is_noetherian() 572 False 573 """ 574 return False 575 576 def krull_dimension(self): 577 """ 578 Return ``Infinity``, since polynomial rings in infinitely many 579 variables have infinite Krull dimension. 580 581 EXAMPLES:: 582 583 sage: R.<x, y> = InfinitePolynomialRing(QQ) 584 sage: R.krull_dimension() 585 +Infinity 586 """ 587 from sage.rings.all import Infinity 588 return Infinity 589 590 def order(self): 591 """ 592 Return ``Infinity``, since polynomial rings have infinitely 593 many elements. 594 595 EXAMPLES:: 596 597 sage: R.<x> = InfinitePolynomialRing(GF(2)) 598 sage: R.order() 599 +Infinity 600 """ 601 from sage.rings.all import Infinity 602 return Infinity 603 604 537 605 class InfinitePolynomialGen(SageObject): 538 606 """ 539 607 This class provides the object which is responsible for returning -
sage/rings/polynomial/polynomial_quotient_ring.py
diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/polynomial/polynomial_quotient_ring.py
a b 544 544 """ 545 545 return self.__ring 546 546 547 cover_ring = polynomial_ring 548 547 549 def random_element(self): 548 550 """ 549 551 Return a random element of this quotient ring. -
sage/rings/quotient_ring.py
diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/quotient_ring.py
a b 35 35 36 36 def QuotientRing(R, I, names=None): 37 37 r""" 38 Creates a quotient ring of the ring R by the ideal I. Variables are39 labeled by names. (If the quotient ring is a quotient of a40 polynomial ring.). If namesisn't given, 'bar' will be appended to41 the variable names in R.38 Creates a quotient ring of the ring `R` by the ideal `I`. Variables are 39 labeled by ``names``. (If the quotient ring is a quotient of a 40 polynomial ring.). If ``names`` isn't given, 'bar' will be appended to 41 the variable names in `R`. 42 42 43 43 INPUTS: 44 44 … … 48 48 49 49 - ``names`` - a list of 50 50 strings to be used as names for the variables in the quotient ring 51 R/I51 `R/I` 52 52 53 OUTPUTS: R/I - the quotient ring R mod the ideal I53 OUTPUTS: `R/I` - the quotient ring `R` mod the ideal `I` 54 54 55 55 EXAMPLES: 56 56 … … 107 107 modulus x^2 + 1 108 108 109 109 By Noether's homomorphism theorems, the quotient of a quotient ring 110 in R is just the quotient of Rby the sum of the ideals. In this111 example, we end up modding out the ideal (x)from the ring112 QQ[x,y]::110 of `R` is just the quotient of `R` by the sum of the ideals. In this 111 example, we end up modding out the ideal `(x)` from the ring 112 `\QQ[x,y]`:: 113 113 114 114 sage: R.<x,y> = PolynomialRing(QQ,2) 115 115 sage: S.<a,b> = QuotientRing(R,R.ideal(1 + y^2)) … … 155 155 156 156 def is_QuotientRing(x): 157 157 """ 158 Tests whether or not x inherits from QuotientRing_generic.158 Tests whether or not ``x`` inherits from :class:`QuotientRing_generic`. 159 159 160 160 EXAMPLES:: 161 161 … … 207 207 """ 208 208 def __init__(self, R, I, names): 209 209 """ 210 Create the quotient ring of R by the ideal I.210 Create the quotient ring of `R` by the ideal `I`. 211 211 212 212 INPUT: 213 213 … … 404 404 405 405 def is_field(self, proof = True): 406 406 r""" 407 Returns Trueif the quotient ring is a field. Checks to see if the407 Returns ``True`` if the quotient ring is a field. Checks to see if the 408 408 defining ideal is maximal. 409 409 410 410 TESTS: … … 428 428 429 429 def is_integral_domain(self, proof = True): 430 430 r""" 431 If this function returns Truethen self is definitely an integral432 domain. If it returns False, then either self is definitely not an431 If this function returns ``True`` then self is definitely an integral 432 domain. If it returns ``False``, then either self is definitely not an 433 433 integral domain or this function was unable to determine whether or 434 434 not self is an integral domain. 435 435 … … 460 460 except NotImplementedError: 461 461 return False 462 462 463 def is_noetherian(self): 464 r""" 465 Return ``True`` if this ring is Noetherian. 466 467 EXAMPLES:: 468 469 sage: R = QuotientRing(ZZ, 102*ZZ) 470 sage: R.is_noetherian() 471 True 472 473 sage: R = QuotientRing(QQ[x], x^2+1) 474 sage: R.is_noetherian() 475 True 476 477 If the cover ring of ``self`` is not Noetherian, we currently 478 have no way of testing whether ``self`` is Noetherian, so we 479 raise an error:: 480 481 sage: R.<x> = InfinitePolynomialRing(QQ) 482 sage: R.is_noetherian() 483 False 484 sage: I = R.ideal([x[1]^2, x[2]]) 485 sage: S = R.quotient(I) 486 sage: S.is_noetherian() 487 Traceback (most recent call last): 488 ... 489 NotImplementedError 490 """ 491 # Naive test: if this is the quotient of a Noetherian ring, 492 # then it is Noetherian. Otherwise we give up. 493 if self.cover_ring().is_noetherian(): 494 return True 495 496 raise NotImplementedError 497 498 463 499 def cover_ring(self): 464 500 r""" 465 501 Returns the cover ring of the quotient ring: that is, the original 466 ring R from which we modded out an ideal, I. 467 468 TODO: PolynomialQuotientRings_field objects don't have a 469 ``cover_ring`` function. 502 ring `R` from which we modded out an ideal, `I`. 470 503 471 504 EXAMPLES:: 472 505 … … 478 511 479 512 sage: Q = QuotientRing(QQ[x], x^2 + 1) 480 513 sage: Q.cover_ring() 481 Traceback (most recent call last): 482 ... 483 AttributeError: 'PolynomialQuotientRing_field' object has no attribute 'cover_ring' 514 Univariate Polynomial Ring in x over Rational Field 484 515 """ 485 516 return self.__R 486 517 … … 538 569 539 570 def _coerce_impl(self, x): 540 571 """ 541 Return the coercion of xinto this quotient ring.572 Return the coercion of `x` into this quotient ring. 542 573 543 574 The rings that coerce into the quotient ring canonically, are: 544 575 … … 627 658 628 659 def gen(self, i=0): 629 660 r""" 630 Returns the ith generator for this quotient ring.661 Returns the `i`-th generator for this quotient ring. 631 662 632 663 EXAMPLES:: 633 664 … … 660 691 Returns the Singular quotient ring of self if the base ring is 661 692 coercible to Singular. 662 693 663 If a valid singular representation is found it is used otherwise a694 If a valid Singular representation is found it is used otherwise a 664 695 new 'qring' is created. 665 696 666 697 INPUT: … … 699 730 def _singular_init_(self,singular=singular_default): 700 731 """ 701 732 Returns a newly created Singular quotient ring matching self if the 702 base ring is coe cable to Singular.733 base ring is coercible to Singular. 703 734 704 735 See self._singular_ 705 736 … … 725 756 INPUT: 726 757 727 758 728 - ``magma`` - a magma instance759 - ``magma`` - a Magma instance 729 760 730 761 731 762 EXAMPLE:: -
sage/rings/ring.pyx
diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/ring.pyx
a b 684 684 return False 685 685 686 686 if proof: 687 r eturnNotImplementedError687 raise NotImplementedError 688 688 else: 689 689 return False 690 690