On Feb 11, 2008 4:54 AM, Georg <[EMAIL PROTECTED]> wrote: > > Hi, > using sage-2.10.1 on a 32-bit core duo with Debian Etch, > considering 2 simple files, > sa.sage: > > load "sb.spyx" > def matmul(M): > return M * (1/2)
spyx files are not "preparsed", so 1/2 is a Python "1/2", which is just 0, since Python does floor division on ints. You may want to put return M * Integer(1)/Integer(2) instead. > > sb.spyx: > > def matmulspyx(M): > return M * (1/2) > > ---------------------------------------------------------------------- > | SAGE Version 2.10.1, Release Date: 2008-02-02 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > > sage: load "sa.sage" > Compiling sb.spyx... > sage: B = MatrixSpace(QQ, 2).identity_matrix() > sage: C = MatrixSpace(RDF, 2).identity_matrix() > sage: D = MatrixSpace(RR, 2).identity_matrix() > sage: matmul(B) > > [1/2 0] > [ 0 1/2] > sage: matmul(C) > > [0.5 0.0] > [0.0 0.5] > sage: matmul(D) > > [0.500000000000000 0.000000000000000] > [0.000000000000000 0.500000000000000] > sage: matmulspyx(B) > > [0 0] > [0 0] > sage: matmulspyx(C) > > [0.0 0.0] > [0.0 0.0] > sage: matmulspyx(D) > > [0.000000000000000 0.000000000000000] > [0.000000000000000 0.000000000000000] > > Must be a bug, or? > thanks, Georg > > > > > -- 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 -~----------~----~----~----~------~----~------~--~---