Coding Challenge #159: Simple Pendulum Simulation

Coding Challenge #159: Simple Pendulum Simulation

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



Duration: 22:14
87,699 views
2,840


Choo choo! In this challenge, I build on chapter 3 (Oscillating Motion) of the Nature of Code series and simulate a simple pendulum in p5.js via angular acceleration. https://thecodingtrain.com/challenges/159-simple-pendulum

πŸ•ΉοΈ p5.js Simple Pendulum https://editor.p5js.org/codingtrain/sketches/SN-39sHAC
πŸ•ΉοΈ p5.js OOP Pendulum: https://editor.p5js.org/codingtrain/sketches/lJz1cmMp4
πŸ•ΉοΈ p5.js Pendulum Array: https://editor.p5js.org/codingtrain/sketches/Bj82tUlIO
πŸŽ₯ Pendulum Array Exploration: https://youtu.be/dpqNqyQCcbY?t=2283

πŸŽ₯ Previous Coding Challenge: https://youtu.be/3MqJzMvHE3E?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next Coding Challenge: https://www.youtube.com/watch?v=Rr-5HiXquhw&list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

πŸŽ₯ Previous Nature of Code Video: https://www.youtube.com/watch?v=okfZRl4Xw-c&list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ Next Nature of Code Video: https://www.youtube.com/watch?v=Rr-5HiXquhw&list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ All Nature of Code Videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM

Links discussed in this video:
πŸ”— Nature of Code Playlist: https://thecodingtrain.com/learning/nature-of-code/index
πŸ”— Applications of Differential Equations - The Simple Pendulum: http://calculuslab.deltacollege.edu/ODE/7-A-2/7-A-2-h.html
πŸ”— Simple Pendulum (myPhysicsLab.com): https://www.myphysicslab.com/pendulum/pendulum-en.html
πŸ”— Object Oriented Simple Pendulum (Nature of Code Book): https://github.com/nature-of-code/noc-examples-p5.js/tree/master/chp03_oscillation/NOC_3_10_PendulumExampleSimplified

Other videos mentioned in this video:
πŸŽ₯ Polar Coordinates - Nature of Code: https://youtu.be/O5wjXoFrau4
πŸŽ₯ 3.2 Angular Motion - Nature of Code: https://youtu.be/i2ROE_mAhU0
πŸŽ₯ Double Pendulum - Coding Challenge #93: https://youtu.be/uWzPe_S-RVE
πŸŽ₯ Coding Train Live! (February 6th 2021): https://youtu.be/dpqNqyQCcbY

Timestamps:
0:00 Choo choo!! 2021 Coding Challenge!
0:43 Code! Drawing a bob and an arm.
1:08 Explain! How are we going to think about this?
2:55 Code! Add our main variables.
3:20 Explain! How do we figure out where the bob is? Trigonometry is the answer!
4:39 Code! Use the polar coordinates formulas we just worked out.
6:30 Code! Let's use angular motion!
7:55 Explain! What is the force of the pendulum? Trigonometry is the answer!
10:46 Code! Add the pendulum force.
12:04 Whoops! Correction on why we multiply by -1.
13:34 Code! Add -1 to the formula.
13:57 Whoops! I figured out some things that I never really understood.
14:24 Code! Correct the 3 step process.
15:32 Something doesn't feel quite right.
16:59 Explain! Angular acceleration relates to the arm length!
18:58 Code! Let's divide by length.
19:54 Code! You could add some damping.
20:21 Ideas! What could you do next?

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/Guides/community-contribution-guide.html
🚩 Suggest Topics: https://github.com/CodingTrain/Rainbow-Topics
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://discord.gg/hPuGy2g
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ“š Books: https://www.amazon.com/shop/thecodingtrain
πŸ–‹οΈ 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