0

I'm having trouble with the following code:

Do[
  P[x_, y_] := Sum[RandomChoice[{-1, 1}]*x^k*y^l, {k, 0, 3}, {l, 0, 3}],
  IrreduciblePolynomialQ[P[x, y]], 
  {12}]

Basically, I just want to generate multiple polynomials (in the above case 12) of the form

P[x_, y_] := Sum[RandomChoice[{-1, 1}]*x^k*y^l, {k, 0, 3}, {l, 0, 3}]

and have a list of whether these polynomials are irreducible. I don't actually need to see the equation of each individual polynomial, I just need a list of true, false so I can estimate some probabilities of irreducibility. Any help with this endeavor is immensely appreciated.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
David_Shmij
  • 189
  • 8

1 Answers1

2

Although I've told you that you can use a Sum[] expression within IrreduciblePolynomialQ[], it will be more expedient for you to use dot products; that is, generate your random coefficients as an array, and then take the dot product of that with a vector containing your basis functions.

Thus,

Table[IrreduciblePolynomialQ[
      (x^Range[0, 3]).RandomChoice[{-1, 1}, {4, 4}].(y^Range[0, 3])], {12}]

should generate the list you want, after which you can use either of Tally[] or Counts[] to help you compute your desired probabilities.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574