> < ^ From:

< ^ Subject:

gap-forum

David Ponce wrote:

gap> R := PolynomialRing(Rationals,["x"]); PolynomialRing(..., [ x ]) gap> gap> f:=x^2+1; 1+x^2 gap> f in R; falsereturn "true"? Am I using the "in" command wrong?

Where did you define the *variable* x? Your first line assigns a

*name* x to Indeterminate(Rationals,1). (If the above is your entire

GAP run. Otherwise it assigns the name "x" to

Indeterminate(Rationals, whichever number), see below.) The line

"f:=x^2+1;" should have produced an error, unless your excerpt is part

of a bigger GAP run, where x was assigned before.

Also, with `PolynomialRing', you have to be very careful with repeated

calls. See the GAP run below:

gap> R := PolynomialRing(Rationals,["x"]);

PolynomialRing(..., [ x ])

gap> f:=x^2+1;

Variable: 'x' must have a value

gap> var:=Indeterminate(Rationals,1);

x

gap> f:=var^2+1;

1+x^2

gap> f in R;

true

gap> R := PolynomialRing(Rationals,["x"]);

PolynomialRing(..., [ x ])

gap> f in R;

false

gap> var:=Indeterminate(Rationals,2);

x

gap> f:=var^2+1;

1+x^2

gap> f in R;

true

gap>

Sincerely,

Luc Teirlinck.

Miles-Receive-Header: reply

> < [top]