
Coding Challenge #159: Simple Pendulum Simulation
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