up previous next
RingElemList, RingElems    --    convert expressions into a LIST of RINGELEM


Syntax
RingElems(R: RING, S: STRING): LIST of RINGELEM
RingElemList(R: RING, S: STRING): LIST of RINGELEM

Description
These functions convert the string S into a LIST of RINGELEM in R; the only difference is that RingElemList expects the list of values in the string to be inside square brackets. The successive values in S must be comma separated.

The expressions in S may contain arithmetic operations and parentheses (but no programming variables nor function calls). These functions are useful for operating with different rings (without needing to call the use command).

RingElems from version 5.3.0; RingElemList from version 5.4.0.

Example
/**/ P ::= ZZ/(5)[x,y];   S ::= QQ[x,y,z[1..4]];

/**/  RingElems(P, "x^2, (x-3*y)^5");  --> elements of P
[x^2,  x^5 +2*y^5]
/**/  RingElemList(S, "[x^2, (x-3*y)^5]");  --> elements of S
[x^2,  x^5 -15*x^4*y +90*x^3*y^2 -270*x^2*y^3 +405*x*y^4 -243*y^5]

-- even for making ideals in new rings:
/**/  I := ideal(RingElems(NewPolyRing(QQ, "i"), "i^2 +1"));  I;
ideal(i^2 +1)

See Also