Revision history [back]

Maple versus Sage, porting issues

Consider the expression

if (m == 3) or (m == -3) : print n, m


Could a simple minded programmer ever expect to see an output different from n, 3 or n, -3 for some n?

No, because it is /verboten/ by logic that m can have a different value as 3 or -3!

Let's check it nevertheless with Maple:

for n from 0 to 50 do
m := n mod 8:
if (m = 3) or (m = -3) then print(n, m) fi od:

3, 3
11, 3
19, 3
27, 3
35, 3
43, 3


And now the same with Sage.

for n in (0..50):
m = mod(n, 8)
if (m == 3) or (m == -3) : print n, m

3 3
5 5
11 3
13 5
19 3
21 5
27 3
29 5
35 3
37 5
43 3
45 5


How many simple minded Maple programmers have broken their necks with such alike?

Could someone please point to a page in the Sage documentation where this is explained and due warnings are given, if such a page exists?

Maple versus Sage, porting issues

Consider the expression

if (m == 3) or (m == -3) : print n, m


Could a simple minded programmer ever expect to see an output different from n, 3 or n, -3 for some n?

No, because it is /verboten/ by logic that m can have a different value as from 3 or -3!

Let's check it nevertheless with Maple:

for n from 0 to 50 do
m := n mod 8:
if (m = 3) or (m = -3) then print(n, m) fi od:

3, 3
11, 3
19, 3
27, 3
35, 3
43, 3


And now the same with Sage.

for n in (0..50):
m = mod(n, 8)
if (m == 3) or (m == -3) : print n, m

3 3
5 5
11 3
13 5
19 3
21 5
27 3
29 5
35 3
37 5
43 3
45 5


How many simple minded Maple programmers have broken their necks with such alike?

Could someone please point to a page in the Sage documentation where this is explained and due warnings are given, if such a page exists?

 3 retagged vdelecroix 7157 ●16 ●78 ●156 http://www.labri.fr/pe...

Maple versus Sage, porting issues

Consider the expression

if (m == 3) or (m == -3) : print n, m


Could a simple minded programmer ever expect to see an output different from n, 3 or n, -3 for some n?

No, because it is /verboten/ by logic that m can have a different value from 3 or -3!

Let's check it nevertheless with Maple:

for n from 0 to 50 do
m := n mod 8:
if (m = 3) or (m = -3) then print(n, m) fi od:

3, 3
11, 3
19, 3
27, 3
35, 3
43, 3


And now the same with Sage.

for n in (0..50):
m = mod(n, 8)
if (m == 3) or (m == -3) : print n, m

3 3
5 5
11 3
13 5
19 3
21 5
27 3
29 5
35 3
37 5
43 3
45 5


How many simple minded Maple programmers have broken their necks with such alike?

Could someone please point to a page in the Sage documentation where this is explained and due warnings are given, if such a page exists?