2.6 Mutual Attraction - The Nature of Code

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



Duration: 22:36
102,210 views
3,301


Finishing off Chapter 2 on forces, let's look at an "N-Body Simulation" where all movers experience gravitational attraction with all other movers! https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/2-forces/6-mutual-attraction

p5.js Web Editor Sketches:
πŸ•ΉοΈ Mutual Attraction (N-Body): https://editor.p5js.org/codingtrain/sketches/bEt7eLZ6Y
πŸ•ΉοΈ Mutual Attraction (N-Body) with Barnes Hut: https://editor.p5js.org/codingtrain/sketches/joXNoi9WL

πŸŽ₯ Previous video: https://youtu.be/EpgB3cNhKPM?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ Next video: https://youtu.be/DMg-WRfNB60?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM

Links discussed in this video:
πŸ”— Newton's law of universal gravitation (Wikipedia): https://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation
πŸ”— Nature of Code Book - 2.10 Everything Attracts (or Repels) Everything: https://natureofcode.com/book/chapter-2-forces/#210-everything-attracts-or-repels-everything
πŸ”— p5.Vector rotate(): https://p5js.org/reference/#/p5.Vector/rotate
πŸ”— N-Body Choreographies research paper by Montaldi and Steckles: https://personalpages.manchester.ac.uk/staff/j.montaldi/Choreographies/about.html
πŸ”— N-Body Choreographies animation tool by Dan Gries: https://personalpages.manchester.ac.uk/staff/j.montaldi/Choreographies/

Other videos mentioned in this video:
πŸŽ₯ 2.5 Gravitational Attraction - The Nature of Code: https://youtu.be/EpgB3cNhKPM
πŸŽ₯ 2.1 Simulating Forces: Gravity and Wind - The Nature of Code: https://youtu.be/Uibl0UE4VH8
πŸŽ₯ 5.1 Autonomous Steering Agents - The Nature of Code: https://youtu.be/P_xJMH8VvAE
πŸŽ₯ 3.1 Angles and Rotation - The Nature of Code: https://youtu.be/DMg-WRfNB60
πŸŽ₯ Coding Challenge #98.1 - Quadtree: https://youtu.be/OJxEcs0w_kE

Timestamps:
0:00 Introducing Today's Topic
0:30 Recap Single attractor system
1:20 The two body problem
2:21 Euler Integration
2:53 Other integration options
4:00 Coding 2-body simulation
7:56 The three body problem
8:15 Coding 3-body simulation
9:04 Refactoring for n-body
10:48 Adding a fourth mover
11:38 Looking at initial states
12:03 Shape 1: donut
13:33 The p5 Vector rotate() function
16:12 Trying out different variations
17:34 Looking at efficiency
19:10 Adding the sun
20:46 Looking at other examples
21:21 Exercise for viewers
22:09 Invite to chapter 3 and goodbye

πŸš‚ 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
βœͺ Nebula: https://go.nebula.tv/codingtrain
πŸ’– 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

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/website/issues/new