Ask Your Question
0

Polynomial Ring bug?

asked 2013-06-09 12:14:51 +0200

blishko gravatar image

updated 2013-06-10 03:56:09 +0200

I would like to ask, why following code ends with error:


R = PolynomialRing(GF(3),'x3,x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x0, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)


because when I remove x0 from the generators, it works fine.


R = PolynomialRing(GF(3),'x3,x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)


Thanks for the answer, but there is still an open question. I have been working with this for a few days, and up untill this case, I had no trouble getting the same polynomial in a ring with fewer genarators, if the original polynomial contained only those. I tried and the followng code works fine, and it also fits your last case which according to you should raise an error, because U has more generators than R.


R = PolynomialRing(GF(3),'x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-09 22:31:09 +0200

Executing g=R(f) calls the __call__ method for the ring R. You should read the documentation for this (by executing R.__call__?). In summary: given two polynomial rings U and R, if every generator of U is a generator for R, then R(f) does the obvious thing, mapping each generator of U to the generator of R with the same name. Otherwise, if U has at most as many generators as R, then map the ith generator of U to the ith generator of R. Otherwise, U must have more generators, so raise an error. Your case fits into this last situation.

edit flag offensive delete link more

Comments

I edited the question. There is a case that fits your last situation, and it does not raise an error. I would like to know the difference.

blishko gravatar imageblishko ( 2013-06-10 03:57:57 +0200 )edit

Your question is answered in R.__call__? docstring, did you read it?

Volker Braun gravatar imageVolker Braun ( 2013-06-10 11:37:43 +0200 )edit

I did, but I don't see it. Could you point me to the sentence that answers my question?

blishko gravatar imageblishko ( 2013-06-11 03:39:19 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-09 12:14:51 +0200

Seen: 253 times

Last updated: Jun 10 '13