I am an undergrad doing math research on gerrymandering. I am trying to find the convexity coefficient of various congressional districts. I plan to do so using a Monte Carlo method through python. Theoretically, I would like to be able to insert the shape of a district, and have python perform multiple tests of picking two random points within the district, connecting a line segment between them, and counting if the line segment is fully contained within the shape. How could I do this? Let me know if you need more clarification, thank you!
submitted by /u/Impressive_Aioli_525
[link] [comments]
r/learnpython I am an undergrad doing math research on gerrymandering. I am trying to find the convexity coefficient of various congressional districts. I plan to do so using a Monte Carlo method through python. Theoretically, I would like to be able to insert the shape of a district, and have python perform multiple tests of picking two random points within the district, connecting a line segment between them, and counting if the line segment is fully contained within the shape. How could I do this? Let me know if you need more clarification, thank you! submitted by /u/Impressive_Aioli_525 [link] [comments]
I am an undergrad doing math research on gerrymandering. I am trying to find the convexity coefficient of various congressional districts. I plan to do so using a Monte Carlo method through python. Theoretically, I would like to be able to insert the shape of a district, and have python perform multiple tests of picking two random points within the district, connecting a line segment between them, and counting if the line segment is fully contained within the shape. How could I do this? Let me know if you need more clarification, thank you!
submitted by /u/Impressive_Aioli_525
[link] [comments]