up previous next
command for making a ring active
Use N
where N is either the identifier of an existing ring or a ring
itself.
|
This command works only at top-level and makes a ring active,
i.e. makes a ring the
current ring.
The command
Use N ::= E;
where E is a ring, is a shorthand for
N ::= E; Use N;
It cannot be called inside a function and it is never necessary (if you
write clean programs ;-) You can define new rings, return rings,
assign them and pass them as arguments (this was not possible in CoCoA-4).
/**/ Use S ::= QQ[x,y,z];
/**/ 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)
|