Ticket #3927: sage-trac3927.patch
| File sage-trac3927.patch, 2.4 kB (added by cremona, 5 months ago) |
|---|
-
a/sage/structure/element.pyx
old new 1233 1233 1234 1234 1235 1235 def __invert__(self): 1236 if self.is_one(): 1237 return self 1236 1238 return 1/self 1237 1239 1238 1240 … … 1544 1546 return self 1545 1547 1546 1548 def __invert__(self): 1549 if self.is_one(): 1550 return self 1547 1551 return 1/self 1548 1552 1549 1553 ################################################## -
a/sage/structure/factorization.py
old new 737 737 738 738 def __add__(self, other): 739 739 """ 740 Return the sum of self and other.740 Return the (unfactored) sum of self and other. 741 741 742 742 EXAMPLES: 743 743 sage: factor(-10) + 16 … … 754 754 755 755 def __sub__(self, other): 756 756 """ 757 Return the sumof self and other.757 Return the (unfactored) difference of self and other. 758 758 759 759 EXAMPLES: 760 760 sage: factor(-10) + 16 … … 883 883 return Factorization([(p,-e) for p,e in reversed(self)], 884 884 cr=self._cr(), unit=self.unit()**(-1)) 885 885 886 def __div__(self, other): 887 r""" 888 Return the quotient of two factorizations, which is obtained by 889 multiplying the first by the inverse of the second. 890 891 EXAMPLES: 892 sage: factor(-10) / factor(-16) 893 2^-3 * 5 894 sage: factor(-10) / factor(16) 895 -1 * 2^-3 * 5 896 897 sage: R.<x,y> = FreeAlgebra(QQ, 2) 898 sage: F = Factorization([(x,3), (y, 2), (x,1)]); F 899 x^3 * y^2 * x 900 sage: G = Factorization([(y, 1), (x,1)],1); G 901 y * x 902 sage: F / G 903 x^3 * y 904 """ 905 if not isinstance(other, Factorization): 906 return self / Factorization([(other, 1)]) 907 return self * other**-1 908 886 909 def value(self): 887 910 """ 888 911 Return the product of the factors in the factorization, multiplied out.