Coding Challenge #95: Approximating the Value of Pi

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=5cNnf_7e92Q



Duration: 27:32
628,102 views
10,431


In this coding challenge, I use use a "monte carlo" method to approximate the value of Pi in Processing (Java). Code: https://thecodingtrain.com/challenges/95-approximating-the-value-of-pi

πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/bv_LWXvU5

πŸŽ₯ Previous video: https://youtu.be/JSn-DJU8qf0?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/WEd_UIKG-uc?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ₯§ Million Pi Digits: http://www.piday.org/million/

Videos:
πŸŽ₯ STEMcoding celebrates Pi day!: https://www.youtube.com/playlist?list=PLISRe8GegO8TbpZK2qvOi6y0kphRI-3xw
πŸš‚ Learning Processing: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZYJC7L-r6rX6utt6wwJCyi
πŸ”΄ Coding Train Live 126.1: https://youtu.be/BOk4Dl-gw14?t=1565s

Related Coding Challenges:
πŸš‚ #96 Visualizing the Digits of Pi: https://youtu.be/WEd_UIKG-uc
πŸš‚ #140 Leibniz Formula for Pi: https://youtu.be/uH4trBNn540
πŸš‚ #156 Peeking Inside Pi: https://youtu.be/MEdpRYyjz_0
πŸš‚ #161 Estimating Ο€ from Random Numbers with Euclid's Algorithm: https://youtu.be/EvS_a921dBo
πŸš‚ #169 Pi in the Sky Game: https://youtu.be/_H9JIwWP7HQ

Timestamps:
0:00 Approximating PI
0:48 Suggestion from akraus53
1:43 Methodology
7:31 Let's code!
13:30 Determine number of "darts" in the circle
18:20 Casting to doubles to increase precision
22:07 Keep track of current best estimate
26:30 Suggestions and conclusion

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://thecodingtrain.com/discord
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: https://p5js.org
πŸ”— p5.js Web Editor: https://editor.p5js.org/
πŸ”— Processing: https://processing.org

πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#montecarlo #estimatingpi #processing







Tags:
live
programming
daniel shiffman
creative coding
coding challenge
tutorial
coding
challenges
coding train
the coding train
live stream
itp nyu
class
challenge
codingtrain
code challenge
code
processing
processing java tutorial
monte carlo pi
pi
pi day
approximate pi
estimating pi using monte carlo
estimating pi with darts
estimating pi with monte carlo
estimating pi
pi processing
pi java
processing double