First time here? Check out the FAQ!

Ask Your Question
1

Random polynomial of degree 1

asked 4 years ago

Sri1729 gravatar image

updated 4 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 4 years ago

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)
Preview: (hide)
link

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

Stats

Asked: 4 years ago

Seen: 552 times

Last updated: Jan 19 '21