On Feb 1, 2008 7:40 AM, Peter Storm <[EMAIL PROTECTED]> wrote: > Professor Stein, > > In the course of my research ambling, I believe I may have come across > a small bug in sage. In a few emails I discussed it with Justin > Walker, and he thought it merits submission. > > In case you're interested, I have included the bug report I intend to > submit below. > > Thank you, > Pete Storm > -- > Mathematics Department > University of Pennsylvania > > %%%%%%%%%%%%%%%%%%%%%%%%%% > > BUG REPORT > > I have sage-2.10 installed on my macpro running Debian lenny. (Sorry > Justin.) It was installed from source code. I did not alter the > code. The command > > ./sage -testall > > returned 0 failed tests. > > Here is an excerpt from my recent session: > > {{{ > > sage: version() > 'SAGE Version 2.10, Release Date: 2008-01-18' > sage: M = FreeModule(Integers(), 2) > sage: 2*M > --------------------------------------------------------------------------- > <type 'exceptions.TypeError'> Traceback (most recent call last) > > /home/storm/.sage/<ipython console> in <module>() > > /home/storm/.sage/element.pyx in sage.structure.element.RingElement.__mul__() > > /home/storm/.sage/coerce.pyx in > sage.structure.coerce.CoercionModel_cache_maps.bin_op_c() > > <type 'exceptions.TypeError'>: unsupported operand parent(s) for '*': > 'Integer Ring' and '<class > 'sage.modules.free_module.FreeModule_ambient_pid'>' > sage: > > }}} > > On the webpage > > http://www.msri.org/about/computing/docs/sage/ref/module-sage.modules.free-module.html#l2h-3124 > > of the documentation one can find the following identical example: > > {{{ > > sage: M = FreeModule(Integers(), 2) > sage: 2*M > Free module of degree 2 and rank 2 over Integer Ring > Echelon basis matrix: > [2 0] > [0 2] > > }}} >
The problem is that the documentation you referee to is about 2 years old, and Sage is 3 years old, and that functionality has been deprecated. In the current version of Sage the correct thing to do is use the scale method: sage: M = FreeModule(Integers(), 2) sage: M.scale(2) Free module of degree 2 and rank 2 over Integer Ring Echelon basis matrix: [2 0] [0 2] sage: M.scale(1/2) Free module of degree 2 and rank 2 over Integer Ring Echelon basis matrix: [1/2 0] [ 0 1/2] > Clearly, my computer did not produce the intended output. My > theory is that, for some reason, sage never checks to see if __rmul__ > is a method for the object M. (This is what python would do.) > Perhaps recent work on coercion has caused this crucial step to be > skipped. > > I have observed similar problems with test classes I've created. In > general, it appears that sage does not look for an __rmul__ method > before returning an error. > > Thank you for any help you can give. > > Best, > Pete Storm > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > -- 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 -~----------~----~----~----~------~----~------~--~---