I am interested in determining the most probable maximum values of the real roots of polynomials of form $P(x)=\sum_{k=0}^n a_{k} x^k$ where the degree $n$ will have a defined value (say 3,4,5...) and $a_k$ are chosen from the set $\{-1,1\}$ with equal probability. Previously I had considered the maximum possible root for a set degree (see my previous question).

So in this case, I'm more looking to:

  1. Enumerate all possible polynomials for a given degree $n$ (e.g. Tuples[{-1, 1}, {4}].{1, x, x^2, x^3} for $n=3$)

  2. For each possible enumerated polynomial $P(x)$ for a given degree, find the maximum $|root|$.

  3. Plot a (bar?) graph of the maximum $|root|$ values and their occurrences. (For a set degree)

So, in this case, rather than finding the maximum possible root a polynomial could have for a set degree $n$, I'd like to graphically see the most probable largest roots of $P(x)$ for $n$ fixed.

Any suggestions/help with this issue is immensely appreciated. Thank You!

  • $\begingroup$ You are aware, I presume, that the number of polynomials of degree n that you describe grows as 2^n. The problem very quickly becomes intractable. $\endgroup$
    – m_goldberg
    Commented Jul 23, 2016 at 20:34
  • $\begingroup$ @m_goldberg I am aware, I have a supercomputer at my disposal, and only wish to consider some lower degrees. For higher degrees, as I've considered different aspects of this problem before, I simply do a sample of polynomials instead of using Tuples to do every single possible polynomial. But yes, this problem very quickly becomes intractable! $\endgroup$ Commented Jul 23, 2016 at 20:38

1 Answer 1


Well, I managed to get the job done in the following way:

roots = x /. NSolve[# == 0, x, Reals] & /@ (Tuples[{-1, 1}, {4}].{1, x, x^2, 
absroots = Abs[roots]
toplot = Map[Max, absroots, 1]
toplot2 = Tally[toplot]

It may not be the cleanest/easiest way, but with simply altering the first line I can do many degrees of $n$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.