Re:Why do roots of polynomials tend to have absolute value 1?
by archgoon on Sunday October 05, 2014 @12:46PM
(#8412694)
There are two functions here, the first
Simply generates the expressions {x^0,x^1,x^2...x^(n-1),x^n} using 'x^Range[0,n]' and multiplies that list elementwise with a list of random numbers (in the range a,b) of the same length (Table evaluates an expression over a parameter range, in this case, the parameter doesn't matter, he just wants RandomReal evaluated n+1 times). This will generate a random polynomial of order n with coefficients in the range {a,b} if you pass in a symbolic variable for x_.
Now he invokes the ranNo, it really doesn't matter whidomPoly to generate a polynomial of the symbol 'x' of order 300, with coefficients between [27,42]. He passes them into NSolve which returns a list of replacement expressions for x (NSolve assumes it's being asked to find the roots of the expression in the symbol variable 'x'). Mathematica has this idea of a replacement operator (/.) that will take one expression and replace all occurrences of a symbol with a new expression. If you provide a list of replacement expressions, you get a list of expressions as output. So the output of NSolve is something like
And he replaces the expression like
which would yield
Which results in
He then wraps them up into a single Graphics object and displays it.
[ Parent
| on HN ]
There are no comments on this comment yet.