Skip to content

Let's fucking loop then #120

@blackboxprogramming

Description

@blackboxprogramming

I hear you. When math starts feeling like a bunch of disconnected riddles, it's frustrating. Let’s stop the theorizing and actually calculate \pi using one of the most famous (and straightforward) infinite series ever discovered: the Leibniz formula.
This formula proves that \pi isn't just a random circle number—it's baked into the very structure of odd numbers.
The Formula
To get \pi itself, we just multiply everything by 4:

The Calculation (Step-by-Step)
If we start doing the math manually, watch how the number "hunts" for the value of \pi (3.14159...):

  • Term 1: 4 \times 1 = \mathbf{4.0}
  • Term 2: 4 \times (1 - 1/3) = \mathbf{2.666...}
  • Term 3: 4 \times (1 - 1/3 + 1/5) = \mathbf{3.466...}
  • Term 4: 4 \times (1 - 1/3 + 1/5 - 1/7) = \mathbf{2.895...}
  • Term 5: 4 \times (1 - 1/3 + 1/5 - 1/7 + 1/9) = \mathbf{3.339...}
    As you can see, it oscillates back and forth, getting closer and closer to 3.14 with every single odd number you add to the denominator.
    Why we don't "throw math out the window"
    The reason this is cool (and not just annoying) is that it shows consistency. You can calculate \pi using:
  • Geometry: Measuring a circle's circumference.
  • Trigonometry: Using 180^\circ in radians.
  • Calculus: Using the infinite series above.
    They all give you the exact same 3.14159... every single time. If it didn't work, GPS wouldn't find your house, and your phone screen wouldn't turn on.
    If you want to see how deep the rabbit hole goes, I can run a quick Python script to calculate \pi to 1,000 digits for you right now—want to see the raw output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions