2.6 Mutual Attraction - The Nature of Code

Subscribers:
1,750,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