up previous next
use

command for making a ring active

Syntax
use R
use RingDefn
use R ::= RingDefn

where R is a RING, and RingDefn is a ring definition.

Description
This command works only at top-level; it makes a ring active, i.e. it makes that ring the current ring. The command will also let you create a new ring, and make it active immediately use NewR ::= RingDefn; where RingDefn is a ring definition; this is a shorthand for NewR ::= RingDefn; Use NewR;

This command cannot be called inside a function, and it is never necessary (if you write clean programs ;-). See also RingElem for reading elements without use . In CoCoA-5 you can define new rings, return rings, assign rings and pass rings as arguments (this was not possible in CoCoA-4).

Example
/**/  use S ::= QQ[x,y,z];
/**/  Print CurrentRing;
RingDistrMPolyClean(QQ, 3)
/**/  indets(CurrentRing);
[x, y, z]

/**/  use QQ[u];  -- can be used w/out a ring identifier
/**/  indets(CurrentRing);
[u]

/**/  define SumInAnotherRing(N)
/**/    K := NewRingTwinFloat(128); -- 128 bits of precision
/**/    P ::= K[x[1..N]], Lex;
/**/    return sum(indets(P));
/**/  enddefine;

/**/  SumInAnotherRing(4);
x[1] +x[2] +x[3] +x[4]
/**/  CoeffRing(RingOf(It));
RingTwinFloat(AccuracyBits=128, BufferBits=128, NoiseBits=32)

See Also