up previous next
4.8.11 Accessing Other Rings
There are a variety of ways of interacting with a ring outside of the current ring. First of all, unlike CoCoA 3.4, starting with CoCoA 3.5, variables are usually assigned to a working memory accessible from all rings. (The only exceptions are variables prefixed by MEMORY. See the chapter entitled Memory Management for further information.) If a variable contains an object which does not depend on a user-defined ring---for example an integer---that object can be immediately accessed and used within any ring. If a variable contains a ring-dependent object such as a polynomial, an ideal, or a module, the variable becomes labeled by the ring in which it was defined. Built-in CoCoA functions should be smart enough to take into account the rings on which their arguments depend (if you find an exception, please send a message to cocoa at dima.unige.it).

To access rings outside of the current ring, one may of course use the command Use to change the current ring. Some other ways of interacting with outside rings:

(1) The :: construction. This construction can be used to define variables or perform operations in rings outside of the current ring.

  Use R ::= QQ[x,y,z];
  I := Ideal(x,y,z)^3;
Ideal(x^3, x^2y, x^2z, xy^2, xyz, xz^2, y^3, y^2z, yz^2, z^3)
  Use S ::= ZZ/(5)[a,b];
  I;  -- I is labeled by its ring, R
R :: Ideal(x^3, x^2y, x^2z, xy^2, xyz, xz^2, y^3, y^2z, yz^2, z^3)
  RingEnv(I);  -- the name of the ring on which I is dependent
  R:: Poincare(R/I);  -- To be sure, one may prefix any operation
                      -- on I by "R::"  although this should not
                      -- be necessary
(1 + 3a + 6a^2)
  R:: (x+y)^2;  -- S is still the active ring, but we can perform
                -- operations in R
R :: x^2 + 2xy + y^2
  J := R :: Ideal(x^2-y);  -- while S is active, one may define an
                           -- object dependent on R.  This variable
                           -- becomes part of the working memory.
R :: Ideal(x^2 - y)
  Use R;
  J;  -- the label is not used if R is active
Ideal(x^2 - y)
(2) Using . From within the current ring one may temporarily perform commands in an another ring using the command Using . A brief example appears below. For more information, see the online help entry for Using .

  Use R ::= QQ[x,y];
  S ::= ZZ/(5)[a,b]; -- the current ring is still R
  Using S Do
    X := (a+b)^5;  -- assign a value to a variable in another ring
S :: a^5 + b^5
  Use S;
a^5 + b^5
(3) Image . To map objects from one ring to another, one may use the command Image . An introduction to this command appears in the following section and more details can be found in the online help entry, Image .

(4) QZP, ZPQ. The commands QZP and ZPQ can sometimes be used to quickly map a polynomial or ideal from an outside ring into the current ring. See the online help entry, QZP , ZPQ , for details.

(5) BringIn . This is the easiest function, but may be slow, to map objects from one ring to another.