To convert an integers to a base(n) string representation you type yourinteger.str(n)
3.str(2) '11' 50.str(4) '302' On 5/27/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > > Hello, > > I am in the process of putting together a Sage tutorial aimed at high > school students and I have the following 2 questions: > > 1) In Mathematica there is a Clear function that is used to clear > variables and an example is Clear [ f, x ]. Is there an equivalent > function in Sage that does this? I have been using the var function > to clear variables but I was wondering if Sage contained a function > like Clear that was more intuitive. > > 2) In the tutorial, I want to cover using Sage to work with different > number bases. I have found that the following code provides a nice > general way to convert base(n) string numbers into Integers: > > x = Integer( '10100101', 2) > > but I have not yet found a general way to convert Integers to base(n) > string numbers. Does anyone know of a general way to do this? > > I think the binary method in the Integer class is close to what I am > looking for and I think that having a more general base(n) method in > the Integer class that works similarly to it would be useful. > > Thanks in advance, > > Ted > > > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---