Coding Challenge #95: Approximating the Value of Pi

[ad_1]
Happy Pi Day!

In this Coding Challenge, I use use a “monte carlo” method to approximate the value of Pi in Processing (Java).

🔗 Million Pi Digits:

🎥 STEMcoding celebrates Pi day!:
🎥 Learning Processing:

🚂 The Coding Train website:
💖 Support this channel on Patreon:
To buy Coding Train merchandise:
📚 Book recommendations:

💻

🎥 For an Introduction to Programming:
🎥 For More Coding Challenges:

🔗
🔗


Posted

in

by

Tags:

Comments

16 responses to “Coding Challenge #95: Approximating the Value of Pi”

  1. Furrane Avatar

    Oh boy, I was just working on a monte carlo approximation (for a hard double integral) and I just knew by looking at the thumbnail that you were using it !!!

    Monte carlo is a cool method, plus I always feel like I'm some sort of rich gambler at a casino roulette while working on it :p

  2. Conrad Ludgate Avatar

    I personally prefer not to use the sqrt function because it is a lot slower. I would instead leave distance squared and compare it to the squared radius.

    EDIT: Oh, you changed it yourself

  3. Michał Kucharski Avatar

    @The Coding Train could you give a code that start algorithm to calculate every digit of Pi?

  4. Ron Swanson Avatar

    Tell me, where can i get this hoodie? Its awesome ;p

  5. Noah Gehlhausen Avatar

    Here's an old way of estimating Pi I made a while ago. The value of Pi it returns is rounded, but it operates with exact values. https://phosphorus.github.io/#182246149

  6. Justin Flowers Avatar

    in fact, my math teacher made the class use the string and ruler, instead of the formula.

  7. Justin Flowers Avatar

    I think he should do a sudoku coding challenge, though I like pi a lot more.

  8. Z Avatar

    What is your recording software?

  9. Quantum Cuber Avatar

    Are we just gonna overlook that someone is getting rich off of a random numbers book?

  10. Mohamed Rezini Avatar

    i'm first LIKE :p

  11. Κίμων Συλαίος Avatar

    How can the dart land in the circle but NOT IN THE SQUARE?

Leave a Reply

Your email address will not be published. Required fields are marked *