I just recently started learning Python. I wrote some simple programs, but the following problem seems like climbing up Mount Everest. I'm taking exercises from a textbook written for math students (the problems are harder to crack), but unfortunately there are no solutions or guidelines. Here it is:
- Randomly generate 10^4 points (x_i, y_i) where x_i and y_i are uniformly distributed on interval [-1,1].
- Figure out: How many of these points are inside uniform circle M and calculate ratio R=4M/N.
- In created script.py repeat this for different seeds (of a generator).
- Export your file into file.dat in which there has to be two columns- seed and R.
- In the same script show (for one random seed) earlier generated points: Points inside uniform circle are coloured red and outside ones are coloured blue.
- Nicely arrange the result with added legend.
- Export the graph into file graph.pdf.
The only hint here is to use Matplotlib for points 5, and 6.
Any help here appreciated.
Aucun commentaire:
Enregistrer un commentaire