On Jan 31, 2008 1:00 AM, Alden <[EMAIL PROTECTED]> wrote: > > Hi, > I get this error when I try to factor a polynomial. I gather that it > seems to be something wrong with Singular? I don't really know what > I'm doing, but I think I set it up correctly. I upgraded to 2.10 > yesterday or so, but this problem happened with the previous version I > had. > Thanks! > -Alden > > > ---------------------------------------------------------------------- > | SAGE Version 2.10, Release Date: 2008-01-18 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > > sage: R.<z> = PolynomialRing(CC,1) > sage: f = z^4 - 6*z + 3 > sage: f.factor()
This is a bug. Fortunately, there is an easy workaround (see below). Don't put PolynomialRing(CC, 1); instead put PolynomialRing(CC). sage: R.<z> = PolynomialRing(CC) sage: f = z^4 - 6*z + 3 sage: f.factor() (1.00000000000000*z - 1.60443920904349) * (1.00000000000000*z - 0.511399619393097) * (1.00000000000000*z + 1.05791941421830 - 1.59281852704435*I) * (1.00000000000000*z + 1.05791941421830 + 1.59281852704435*I) The problem is that PolynomialRing(CC,1) creates a *multivariate polynomial ring* which happens to be in 1 variable, whereas PolynomialRing(CC) creates a univariate polynomial ring (which is implemented under the hood differently than a multivariate polynomial ring). The bug is that PolynomialRing(CC,1) should create a univariate ring, whereas MPolynomialRing(CC,1) should be how one creates a multivariate poly ring in 1 variable. (I think.) Alternatively, the bug is that factoring a multivariate polynomial in 1 variable uses Singular instead of other better univariate code that we have. I've made http://trac.sagemath.org/sage_trac/ticket/2000 about this. > --------------------------------------------------------------------------- > <type 'exceptions.TypeError'> Traceback (most recent call > last) > > /home/alden/<ipython console> in <module>() > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/rings/ > polynomial/multi_polynomial_element.py in factor(self) > 1049 R = self.parent() > 1050 R._singular_().set_ring() > -> 1051 S = self._singular_().factorize() > 1052 factors = S[1] > 1053 exponents = S[2] > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/ > interfaces/expect.py in __call__(self, *args) > 952 > 953 def __call__(self, *args): > --> 954 return self._obj.parent().function_call(self._name, > [self._obj] + list(args)) > 955 > 956 def help(self): > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/ > interfaces/expect.py in function_call(self, function, args) > 899 if not isinstance(args[i], ExpectElement): > 900 args[i] = self.new(args[i]) > --> 901 return self.new("%s(%s)"%(function, ",".join([s.name() > for s in args]))) > 902 > 903 def call(self, function_name, *args): > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/ > interfaces/expect.py in new(self, code) > 801 > 802 def new(self, code): > --> 803 return self(code) > 804 > 805 > ################################################################### > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/ > interfaces/singular.py in __call__(self, x, type) > 440 x = str(x)[1:-1] > 441 > --> 442 return SingularElement(self, type, x, False) > 443 > 444 > > /usr/local/sage-2.8.15/local/lib/python2.5/site-packages/sage/ > interfaces/singular.py in __init__(self, parent, type, value, is_name) > 761 except (RuntimeError, TypeError, > KeyboardInterrupt), x: > 762 self._session_number = -1 > --> 763 raise TypeError, x > 764 else: > 765 self._name = value > > <type 'exceptions.TypeError'>: Singular error: > ? not implemented > ? error occurred in STDIN line 8: `def sage2=factorize(sage1);` > sage: > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---