Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Variables r and R are gobbled

If implicit multiplication is not active, something like 4y^2 should raise an error. This is what actually happens:

sage: var("y"); 4y^2
  File "<ipython-input-22-25bcbc82148c>", line 1
    var("y"); 4y**Integer(2)
               ^
SyntaxError: invalid syntax

If we replace y by a different variable or consider a similar expression, we also get an error... except if the variable is r or R. For example,

sage: var("r, R"); 4r^2, 3R + 5r + 2R^3
(16, 16)

Surprisingly, there is no error. Variables r and R seem to be gobbled, so that SageMath parses 4r^2 as 4**Integer(2) and 3R + 5r + 2R^3 as 3 + 5 + 2**Integer(3). Why?

Variables r and R are gobbled

If implicit multiplication is not active, something like 4y^2 should raise an error. This is what actually happens:

sage: var("y"); 4y^2
  File "<ipython-input-22-25bcbc82148c>", line 1
    var("y"); 4y**Integer(2)
               ^
SyntaxError: invalid syntax

If we replace y by a different variable or consider a similar expression, we also get an error... except if the variable is r or R. For example,

sage: var("r, R"); 4r^2, 3R + 5r + 2R^3
(16, 16)

Surprisingly, there is no error. Variables r and R seem to be gobbled, so that SageMath parses 4r^2 as 4**Integer(2) and 3R + 5r + 2R^3 as 3 + 5 + 2**Integer(3). Why?Why? Is this a bug?