Coding Challenge #140: Pi Approximation with Leibniz Series

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



Duration: 13:04
101,386 views
2,425


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







Tags:
daniel shiffman
coding
the coding train
coding challenge
creative coding
code challenge
javascript (programming language)
programming challenge
pi
pi day
pi day javascript
euler method
pi digits
p5.js
p5.js web editor
coding train
approximate pi
p5.js tutorial
pi day coding challenge
pi day coding
leibniz
leibniz pi
leibniz series
leibniz formula
pi approximation
Pi Day