I am porting some Mathematica code to sage and I ran into a minor
issue.  I was using the Mod command in mathematica with argument types
Mod[float,integer] to create a periodic function.  In sage, the mod
command gives an error on that sort of input.  So I made a simple
function:

def float_mod(x,divisor):
    '''An extension of the mod command for floats.'''
    return x-floor(float(x)/divisor)*divisor

which does what I want.  Is there something like this already in
sage?  I know the normal python % operation does something similar but
that's taken out by the preparser.


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@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-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to