CoCoA:HowTo:Use Modular Numbers: Difference between revisions

From ApCoCoAWiki
Bigatti (talk | contribs)
I'm going to save every step now: I don't want to lose my edit again!
 
m Bot: Replacing category HowTo with HowTo Old
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  Type(5);
== Question ==
INT
How can one compute with modular numbers?  What's wrong in this?
-------------------------------
  Use R::=Z/(5)[x];
5 e' un intero, e gli interi non dipendono dall'anello corrente (puoi
  5x+2y;
immaginarti cosa succederebbe a un ciclo For?)
2y
-------------------------------
  5=0;
FALSE
-------------------------------
Moreover this command throws an error
  Use R::=Z/(5);


per vedere 5 come modulare devi fare:
== Answer ==
  5 % 5;
  Type(5);
0 % 5
INT
-------------------------------
-------------------------------
(analogo al C) oppure immergerlo nell'anello di polinomi
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)?  ;-)
  Use R::=Z/(5)[x];
 
  Poly(5);
If you want to use 5 as a modular number you should either use this syntax (similar to C/C++)
0
  5 % 5;
-------------------------------
0 % 5
-------------------------------
or embed your integer into the polynomial ring
  Use R::=Z/(5)[x];
  Poly(5);
0
-------------------------------
The creation of a polynomial ring with no indeterminates has been disabled to highlight this (unexpected?) behaviour.
 
by [[User:Bigatti|Bigatti]] 17:26, 29 Nov 2005 (CET)
 
[[Category:HowTo Old]]
[[Category:CoCoA4]]

Latest revision as of 09:44, 29 October 2020

Question

How can one compute with modular numbers? What's wrong in this?

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

Moreover this command 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 either 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
-------------------------------

The creation of a polynomial ring with no indeterminates has been disabled to highlight this (unexpected?) behaviour.

by Bigatti 17:26, 29 Nov 2005 (CET)