Coding Challenge #140: Pi Approximation with Leibniz Series
In this coding challenge, I use the Leibniz formula (aka infinite series) to approximate the digits of Pi and graph the convergence. Code: https://thecodingtrain.com/challenges/140-pi-leibniz
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/8nvCqk0-W
π₯ Previous video: https://youtu.be/PoW8g67XNxA?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/pn2vlselv_g?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
π Leibniz formula for Pi: https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80
Videos:
π½οΈ Pi and the Mandelbrot Set: https://youtu.be/d0vY0CKYhPY
π΄ Coding Train Live 172: https://youtu.be/78ZthTGcdPw?t=5795s
Related Coding Challenges:
π #21 Mandelbrot Set with p5.js: https://youtu.be/6z7GQewK-Ks
π #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 Introduction
1:22 The Leibniz method for approximating pi!
1:57 Let's start coding!
4:59 Visualizing the convergence
8:45 Drawing a line where pi originally exists
9:43 Debugging!
10:49 Refactoring the code a bit
11:43 Try other series!
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
#leibnizformula #piapproximation #p5js #javascript