{"id":20080435,"url":"https://github.com/drvinceknight/geometryprobabilityandpi","last_synced_at":"2026-02-17T06:32:58.674Z","repository":{"id":15734166,"uuid":"18472579","full_name":"drvinceknight/GeometryProbabilityandPi","owner":"drvinceknight","description":null,"archived":false,"fork":false,"pushed_at":"2014-04-05T18:06:28.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-19T10:59:24.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drvinceknight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-05T17:53:12.000Z","updated_at":"2014-04-05T18:06:28.000Z","dependencies_parsed_at":"2022-09-11T09:21:34.535Z","dependency_job_id":null,"html_url":"https://github.com/drvinceknight/GeometryProbabilityandPi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/drvinceknight/GeometryProbabilityandPi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drvinceknight%2FGeometryProbabilityandPi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drvinceknight%2FGeometryProbabilityandPi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drvinceknight%2FGeometryProbabilityandPi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drvinceknight%2FGeometryProbabilityandPi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drvinceknight","download_url":"https://codeload.github.com/drvinceknight/GeometryProbabilityandPi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drvinceknight%2FGeometryProbabilityandPi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29535977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T05:00:25.817Z","status":"ssl_error","status_checked_at":"2026-02-17T04:57:16.126Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T15:28:32.063Z","updated_at":"2026-02-17T06:32:58.650Z","avatar_url":"https://github.com/drvinceknight.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"Repo containing resources for an outreach activity aiming to use dice to get an estimate for pi.\n\nYou can see a fully rendered version of this [here](http://www.vincent-knight.com/outreach/geometry_probability_and_pi/).\n\n### Requirements:\n\nSufficient copies of the grid.pdf file and ten sided dice (depending on numbers students can be paired up).\n\n\n### Instructions\n\nThe activity starts with a rather cryptic set of instructions:\n\n1. Roll dice so as to obtain random coordinates for 10 points;\n2. Place these points on the grid (don't worry where they go in the boxes);\n3. Count the points that sit within the circle and perform the requested calculations.\n\nOnce this is done, ask the students what values they have obtained and if they know what this might be about?\n\nKeep track of the numbers of the board and finally carry out a calculation over the total number of points.\n\n\n### Explanations\n\nAs a group explain that probability of any given point landing in the circle is given by:\n\n$$P(\\text{point in circle})=\\frac{\\text{Area of circle}}{\\text{Area of square}}$$\n\nIf we let \\\\(r\\\\) denote the radius of the circle this gives:\n\n$$P(\\text{point in circle})=\\frac{\\pi r^2}{(2r)^2}=\\frac{\\pi}{4}$$\n\nOur data however gives us an **estimate** of \\\\(P(\\text{point in circle})\\\\):\n\n$$P(\\text{point in circle})\\approx \\frac{n}{N}$$\n\nThus we have:\n\n$$\\pi\\approx 4\\frac{n}{N}$$\n\nAt this point ask if what would make the experiment everyone did better? (Answer: more data).\n\n\n### Code\n\nIdeally some students might realise that another approach to doing this would be to get a computer to calculate this for us.\nThe following is some [Sage](http://sagemath.org/) code that will simulate the points and plot them as well:\n\n    def simpoints(N=1000):\n        \"\"\"\n        Defines a function that will simulate N points\n        \"\"\"\n        points = [[2 * (random() - .5), 2 * (random() - .5)] for k in range(N)]  # Create all our points\n        pointsincircle = [k for k in points if k[0] ^ 2 + k[1] ^ 2 \u003c= 1]  #  Count the ones that are in the circle\n        p = list_plot(pointsincircle, color='blue')  # Plot the ones in the circle in blue\n        p += list_plot([k for k in points if k not in pointsincircle], color='black')  # Plot the others in black\n        p.show()  # Show the plot\n        return 4 * len(pointsincircle) / N  # Return the approximated value of pi\n\n    simpoints(1000)  # Run the above for 1000 points\n\n\n\n\n### Alternative\n\nThis **is not** an efficient way of calculating pi.\nHere is a formula by Srinivasa Ramanujan (1887-1920) that is much more efficient:\n\n$$\\pi = \\frac{9801}{\\sqrt{8}}\\left(\\sum_{k=0}^{\\infty}\\frac{(4k)!(1103+26390k)}{(k!)^4396^{4k}}\\right)^{-1}$$\n\nThe following Sage code shows that just the first two terms of our sum give a great approximation of \\(\\pi\\):\n\n    k = var('k')\n    f = lambda n : 9801 / sqrt(8) * (sum((factorial((4*k))*(1103 + 26390 * k))/((factorial(k))^4 * 396 ^ (4 * k)),k,0,n))^(-1)\n    float(f(1))\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrvinceknight%2Fgeometryprobabilityandpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrvinceknight%2Fgeometryprobabilityandpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrvinceknight%2Fgeometryprobabilityandpi/lists"}