On 31 August 2016 at 16:24, leif <not.rea...@online.de> wrote: > John Cremona wrote: > > Indeed, that is a bug in line 371 of the file > > sage/modules/free_quadratic_module.py -- an easy fix. > > ... and more than 8 years old. > > The check whether the rank is even or not is useless as well; '//' in > Python is integer division (taking the floor). >
Agreed (not that n is the 'rank' not r! > > (And the docstrings don't use proper markup...) > > > > Perhaps someone ought to look through all occurrences of ^ in .py files > > outside of docstrings (where they are OK thanks to preparsing). > > Well, there are a couple of valid xor uses in the Sage library as well. > Certainly, but a human would be able to work out which ones were really supposed to be xor! John > > > -leif > > > On 31 August 2016 at 13:44, Simon Brandhorst <sbrandho...@web.de > > <mailto:sbrandho...@web.de>> wrote: > > > > > > { > > sage: q=FreeQuadraticModule(ZZ,2,inner_product_matrix=1) > > sage: q > > Ambient free quadratic module of rank 2 over the principal ideal > > domain Integer Ring > > Inner product matrix: > > [1 0] > > [0 1] > > sage: q.determinant() > > 1 > > sage: q.discriminant() > > -2 > > } > > #The expected value here is -1 > > > > The following example should clarity what is wrong. > > { > > sage: q=FreeQuadraticModule(QQ,2,inner_product_matrix=1) > > sage: q.determinant() > > 1 > > sage: q.discriminant() > > ------------------------------------------------------------ > --------------- > > RuntimeError Traceback (most recent > > call last) > > <ipython-input-204-22cd2398c8db> in <module>() > > ----> 1 q.discriminant() > > > > /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/ > modules/free_quadratic_module.pyc > > in discriminant(self) > > 377 else: > > 378 r = (n-1)//2 > > --> 379 return (-1)^r*self.gram_matrix().determinant() > > 380 > > 381 def gram_matrix(self): > > > > sage/structure/element.pyx in sage.structure.element.Element.__xor__ > > (/usr/lib/sagemath//src/build/cythonized/sage/structure/ > element.c:8229)() > > > > RuntimeError: Use ** for exponentiation, not '^', which means xor > > in Python, and has the wrong precedence. > > } > > > > This happened with sage 7.0 and 7.2 on two different machines. > > (Ubuntu 14.04.4 LTS, and fedora 24) > > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.