Coding Challenge #95: Approximating the Value of Pi
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