I am interested in "automating" the following notebook file so that I can execute it many times to generate many plots.
roots = x /. NSolve[Sum[RandomVariate[NormalDistribution[]]*x^k, {k, 0, 1000}] ==
0, x, Reals]
difs = Differences[roots]
a = Tally[difs]
ListPlot[a, AxesLabel -> {diffs, occurences}, PlotLabel -> "A Degree 1000" , PlotRange -> Full]
Export["plot.pdf", %]
Each time the code is evaluated, I of course obtain a different plot. I would like to have maybe 100 of the plots but this would be rather tedious as I have to save the plot output as a PDF individually and run the whole notebook each time. I also want to do other degrees than 1000 so I will definitely need to automate this process. I have looked into the Wolfram Script stuff, but am a bit lost/ not sure what to do. Is it possible to turn this notebook file (with 4 cells of evaluation) into a script such that I can just run it over and over with one easy command in a command line to generate multiple plots?
Any help with this issue is immensely appreciated! Thank you!
Do
loop? $\endgroup$Table
toMap
. Also, please post code, not images with code. $\endgroup$