up previous next
3.8.2 Working Memory
The working memory consists of all variables except those defined with the prefix MEMORY, e.g. MEMORY.X. All variables in the working memory are accessible from all rings, but they are not accessible from within a user-define function (see examples in the next section). The function Memory displays the contents of the working memory. More information is provided by Describe Memory().

Ring-dependent variables such as those containing polynomials, ideals, or modules, are labeled by their corresponding rings. If the ring of a ring-dependent variable in the working memory is destroyed, the variable will continue to exist, but labeled by a ring automatically generated by CoCoA. Once all variables dependent on this new ring cease to exist, so does the ring.

Example
  Use R ::= QQ[x,y,z];
  Memory();  -- the working memory is empty
[ ]
-------------------------------
  I := Ideal(xy-z^3,x^2-yz);
  X := 3;
  M := Mat([[1,2],[3,4]]);
  Memory();
["I", "It", "M", "X"]
-------------------------------
  Describe Memory();
------------[Memory]-----------
I = Ideal(-z^3 + xy, x^2 - yz)
It = ["I", "It", "M", "X"]
M = Mat([
  [1, 2],
  [3, 4]
])
X = 3
-------------------------------
  Use S ::= ZZ/(3)[t];  -- switch to a different ring
  X := t^2+t+1;  -- the identifier X is used again
  Y := 7;
Describe Memory();  -- note that I is labeled by its ring
------------[Memory]-----------
I = R :: Ideal(-z^3 + xy, x^2 - yz)
It = ["I", "It", "M", "X"]
M = Mat([
  [1, 2],
  [3, 4]
])
X = t^2 + t + 1
Y = 7
-------------------------------
  GBasis(I);  -- The Groebner basis for the ideal in R can be calculated
              -- even though the current ring is S.
[R :: x^2 - yz, R :: -z^3 + xy]
-------------------------------
  M^2;
Mat([
  [7, 10],
  [15, 22]
])
-------------------------------
  Use R ::= QQ[s,t];  -- redefine the ring R
  I;  -- Note that I is labeled by a new ring, automatically produced by
      -- CoCoA.  This ring will automatically cease to exist when there
      -- are no longer variables dependent upon it, as shown below.
R#17 :: Ideal(-z^3 + xy, x^2 - yz)
-------------------------------
  RingEnvs();
["QQ", "QQt", "R", "R#17", "S", "ZZ"]
-------------------------------
  I := 3; -- I is overwritten with an integer, and since it is the only
          -- variable dependent on R#17, the ring R#17 ceases to exist.
  RingEnvs();  -- Since the only variable that was dependent upon the
               -- temporary ring "R#17" was overwritten, that ring is
               -- destroyed.
["QQ", "QQt", "R", "S", "ZZ"]
-------------------------------