hello Mike thank you very much for your information, I've looking for a solution the whole evening, I did not notice that the ^ is of course the XOR operator!!!!
Mike Hansen wrote: > Hello, > > On Sun, Mar 15, 2009 at 2:48 PM, Jose Guzman <[email protected]> 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---
