up previous next
RingElem

convert an expression into a RINGELEM

Syntax
RingElem(R: RING, E: RINGELEM): RINGELEM
RingElem(R: RING, E: INT): RINGELEM
RingElem(R: RING, E: RAT): RINGELEM
RingElem(R: RING, E: STRING): RINGELEM
RingElem(R: RING, E:[STRING, INT, .., INT]): RINGELEM

Description
This function converts the expression E into a RINGELEM in R, if possible.

Can be used for mapping ring element between rings when a CanonicalHom exists. For other homomorphisms search see RINGHOM .

In some cases ReadExpr may be handier: it reads a whole expression without function calls from a STRING .

Example
/**/  Use P ::= QQ[x,y,z];
/**/  -- RINGELEM (via CanonicalHom)
/**/  F := 2*x-3;
-- /**/  F/LC(F); -- !!! ERROR !!!  LC(F) in CoeffRing(P)
/**/  F/RingElem(P,LC(F));
x +1
-- /**/  1/x; -- !!! ERROR !!!  x in P is not invertible
/**/  K := NewFractionField(P);
/**/  1/RingElem(K, x); -- x in K is invertible
1/x

/**/  Use P ::= ZZ/(5)[x,y,z];
/**/  -- INT and RAT
/**/  RingElem(P, 7);
2
/**/  RingElem(P, 3/2);
-1

/**/  -- STRING (indet name, symbol)
/**/  S ::= QQ[x,y,z[1..4,3..7]];
/**/  7*RingElem(P, "x");  --> x as an element of P
2*x
/**/  7*RingElem(S, "x");  --> x as an element of S
7*x
/**/  7*RingElem(S, ["z",2,5]);
7*z[2,5]
/**/  ReadExpr(S, "((7/3)*z[2,5] - 1)^2" ); -- expr without function calls
49*z[2,5]^2 -14*z[2,5] +1

See Also