Python Forum
Complex Program with matplotlib - Python Challenge
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complex Program with matplotlib - Python Challenge
#1
I had this on my programming exam last week. I still don't get desired outcome. Wall

How would you solve it?

1 Randomly generate 10^4 points (x_i, y_i) where x_i and y_i are uniformly distributed on interval [-1,1].
2 Figure out: How many of these points are inside uniform circle M and calculate ratio R=4M/N.
3 In created script.py repeat this for different seeds (of a generator).
4 Export your file into file.dat in which there has to be two columns- seed and R.
5 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.
6 Nicely arrange the result with added legend.
7 Export the graph into file graph.pdf.

Hint: use Matplotlib for points 5, and 6.
Reply


Messages In This Thread
Complex Program with matplotlib - Python Challenge - by maggie_b - Apr-08-2018, 02:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PySpark Coding Challenge cpatte7372 4 6,292 Jun-25-2023, 12:56 PM
Last Post: prajwal_0078
Heart how to solve complex equations in python HoangF 3 2,925 Dec-26-2021, 07:04 PM
Last Post: HoangF
  string format challenge jfc 2 1,843 Oct-23-2021, 10:30 AM
Last Post: ibreeden
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,363 Mar-11-2021, 10:52 AM
Last Post: buran
  Stuck on python quiz challenge baesian 2 2,266 Aug-16-2020, 12:52 AM
Last Post: scidam
  Very difficult challenge for me cristfp 1 2,805 Apr-01-2019, 08:45 PM
Last Post: Yoriz
  Challenge with my string SpencerH 3 2,999 Oct-12-2018, 11:58 AM
Last Post: SpencerH

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020