Ask Your Question

Random polynomial of degree 1

asked 2021-01-19 07:00:12 +0200

Sri1729 gravatar image

updated 2021-01-19 12:09:54 +0200

slelievre gravatar image

Having defined

  • the finite field K of size 4 in a
  • a polynomial ring R1 over K

one can ask for a random element using the random_element method.

The random polynomial I obtained that way was of degree two:

sage: K.<a> = FiniteField(4)
sage: R1 = PolynomialRing(K, ['z%s' % p for p in range(1, 3)])
sage: R1.random_element()
(a)*z1*z2 + (a + 1)*z2^2 + z1 + (a)*z2

If I only want a random linear polynomial from this ring, how can I get one?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-01-19 09:18:48 +0200

tmonteil gravatar image

You can get the documentation of the random_element method by typing:

sage: R1.random_element?

As you can see, you can specify the degree, so the following should work:

sage: R1.random_element(degree=1)
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2021-01-19 07:00:12 +0200

Seen: 374 times

Last updated: Jan 19 '21