CoCoA:HowTo:Use Modular Numbers: Difference between revisions

From ApCoCoAWiki
Bigatti (talk | contribs)
mNo edit summary
Bigatti (talk | contribs)
mNo edit summary
Line 5: Line 5:
   5x+2y;
   5x+2y;
  2y
  2y
-------------------------------
-------------------------------
   5=0;
   5=0;
  FALSE
  FALSE
-------------------------------
-------------------------------
Moreover this throws an error
Moreover this throws an error
   Use R::=Z/(5);
   Use R::=Z/(5);
=== Answer ===
=== Answer ===
  Type(5);
  Type(5);
INT
INT
-------------------------------
-------------------------------
5 e' un intero, e gli interi non dipendono dall'anello corrente (puoi
5 is an integer, and integers do not depend on the current ring: could you imagine what would happen to a For cycle over Z/(2)? ;-)
immaginarti cosa succederebbe a un ciclo For?)
If you want to use 5 as a modular number you should use this syntax (similar to C/C++)
 
  5 % 5;
per vedere 5 come modulare devi fare:
0 % 5
  5 % 5;
-------------------------------
0 % 5
or embed your integer into the polynomial ring
-------------------------------
  Use R::=Z/(5)[x];
(analogo al C) oppure immergerlo nell'anello di polinomi
  Poly(5);
  Use R::=Z/(5)[x];
0
  Poly(5);
-------------------------------
0
-------------------------------

Revision as of 14:45, 29 November 2005

Modular Numbers

Question

What's wrong in this?

  Use R::=Z/(5)[x];
  5x+2y;
2y
-------------------------------
  5=0;
FALSE
-------------------------------

Moreover this throws an error

  Use R::=Z/(5);

Answer

  Type(5);
INT
-------------------------------

5 is an integer, and integers do not depend on the current ring: could you imagine what would happen to a For cycle over Z/(2)?  ;-) If you want to use 5 as a modular number you should use this syntax (similar to C/C++)

  5 % 5;
0 % 5
-------------------------------

or embed your integer into the polynomial ring

  Use R::=Z/(5)[x];
  Poly(5);
0
-------------------------------