# Expectation of Largest Roots of Bernoulli distributed coefficient Monomials

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!

• 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. Jul 23, 2016 at 20:34
• @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! Jul 23, 2016 at 20:38

roots = x /. NSolve[# == 0, x, Reals] & /@ (Tuples[{-1, 1}, {4}].{1, x, x^2,

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