Elektrine lite

← Feed

@oddtail@meow.social

Post #1395434

2026-04-16 13:04 UTC

So it was Pi Day recently (by which I mean, a month ago), and I was inspired by how Matt Parker always calculates Pi using increasingly convoluted methods. So I calculated it the most straightforward way possible. Take a grid of n by n. Count how many of cells in that grid are positioned so that x^2 + y^2 < n^2 (n being the radius of the implicit circle). That's the approximate area of a quarter-circle with a radius of n. Then divide that by (n/4) and you've got, more or less, the value of pi. Like... it's extremely simple mathematics, a particularly maths-inclined Elementary School student can do this and understand the process. But crucially, *I* have never personally done this. Why should I take the value of Pi on faith? It's fun to do an experiment even if you know what result you should get. In fact, perhaps ESPECIALLY when you know what result you should get. I helped myself with LibreOffice, because I am not adding a few thousand squared integers by hand (of course I could make it simpler by only seeing where the boundary of the circle approximately is and then just counting the cells near that expected border. Whatever. Still hundreds of numbers). I used a LibreOffice spreadsheet. I was curious how exact I was going to get. And I was pleasantly surprised. With a grid of 100 by 100, Pi can be calculated to be about 7750/2500, so about 3.1 - that is pretty accurate! By the way, my first calculation, which i did do by hand with the help of some pictures, was for a radius of n=10, and I can confidently say based on that method that Pi is approximately 2.76 . So that's neat too! EDIT: and of course, if you calculate for a 1-by-1 grid, you know that Pi is approximately 4 which, let's be honest, is all the precision you will ever need.

Replies (1)

  • @oddtail@meow.social 2026-04-16 13:12

    And like... to do this, I need to be able to multiply and divide integers, to know the formula for the area of a circle (which is a bit of a cheat... I should've calculated from the length of the circle's circumference because I think that's the definition of Pi), and to know the Pythagorean Theorem (or be able to derive it, which I'm pretty sure I'm capable of doing). So it's like, only minimally mathematical.

    Open ##1517469