Hello, On Sun, Mar 15, 2009 at 2:48 PM, Jose Guzman <n...@neurohost.org> wrote: > > something strange happened to me today, if I try > > In [1]: 6*21/18-2^3 > Out[1]: 6 > > However, if I try the following > > In [2]: 6*21/18-2**3 > Out[2]: -1 > > then the normal operator precedence (parenthesis, exponential, > multilplication-division-remainder, addition-subtraction) occurs. Does > anybody have a comment on that?
In Python, "^" represents the XOR operator where as "**" is exponentiation. In [3]: 2**3 Out[3]: 8 In [4]: 2^3 Out[4]: 1 At the Sage command-line, the "^" are changed into "**" so that you'd get the behavior you'd expect: sage: preparse('2^3') 'Integer(2)**Integer(3)' sage: 2^3 8 --MIke --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---