I'm interested on how to count the number of real roots of a random polynomials in an instant, how to put the result in a table and how to plot it in a graph.I generated 1 million random polynomials following Gaussian Distribution with mean 0 and variance 1. I used this command
r:=GaussianDistribution[0,1]
y=randompol[n_,i_]:=Sum[r x^{j},{j,0,n}]
Solve[y==0,x]
CountRoots[y,x]
But the command Countroots does not apply for it says that the above generated random polynomials is not univariate. But it seems awkward that when I manually paste the generated random polynomial to the CountRoots command instead of using link, it works!
But I want to do it in 1 million random polynomials and it is not practical for me to do so. I already used y//Tableform
and Remove[{}]
because I thought that the problem is braces since the random polynomials generated using this command y=randompol[n_,i_]:=Sum[r x^{j},{j,0,n}]
is inside a brace while the CountRoots
command does not require braces, but i Failed and it did not work.
please help me...
Solve
unnecessary, your function doesn't produce any polynomials and what isi
? $\endgroup$;
at the end of the lines of code -- I've also removed them. Btw, next time please post comments to answers as comments to those answers, not as a comment of your own question :). $\endgroup$