2.6 Mutual Attraction - The Nature of Code

Published: 28 March 2022
on channel: The Coding Train
115,298
3.6k

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...

p5.js Web Editor Sketches:
🕹️ Mutual Attraction (N-Body): https://editor.p5js.org/codingtrain/s...
🕹️ Mutual Attraction (N-Body) with Barnes Hut: https://editor.p5js.org/codingtrain/s...

🎥 Previous video:    • 2.5 Gravitational Attraction - The Na...  
🎥 Next video:    • 3.1 Angles and Rotation - Nature of Code  
🎥 All videos:    • The Nature of Code  

Links discussed in this video:
🔗 Newton's law of universal gravitation (Wikipedia): https://en.wikipedia.org/wiki/Newton'...
🔗 Nature of Code Book - 2.10 Everything Attracts (or Repels) Everything: https://natureofcode.com/book/chapter...
🔗 p5.Vector rotate(): https://p5js.org/reference/#/p5.Vecto...
🔗 N-Body Choreographies research paper by Montaldi and Steckles: https://personalpages.manchester.ac.u...
🔗 N-Body Choreographies animation tool by Dan Gries: https://personalpages.manchester.ac.u...

Other videos mentioned in this video:
🎥 2.5 Gravitational Attraction - The Nature of Code:    • 2.5 Gravitational Attraction - The Na...  
🎥 2.1 Simulating Forces: Gravity and Wind - The Nature of Code:    • 2.1 Simulating Forces: Gravity and Wi...  
🎥 5.1 Autonomous Steering Agents - The Nature of Code:    • 5.1 Autonomous Steering Agents Introd...  
🎥 3.1 Angles and Rotation - The Nature of Code:    • 3.1 Angles and Rotation - Nature of Code  
🎥 Coding Challenge #98.1 - Quadtree:    • Coding Challenge #98.1: Quadtree - Pa...  

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/com...
🚩 Suggest Topics: https://github.com/CodingTrain/Rainbo...
💡 GitHub: https://github.com/CodingTrain
💬 Discord:   / discord  
✪ Nebula: https://go.nebula.tv/codingtrain
💖 Membership: http://youtube.com/thecodingtrain/join
🛒 Store: https://standard.tv/codingtrain
📚 Books: https://www.amazon.com/shop/thecoding...
🖋️ Twitter:   / thecodingtrain  
📸 Instagram:   / the.coding.train  

🎥 Coding Challenges:    • Coding Challenges  
🎥 Intro to Programming:    • Start learning here!  

🔗 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-o...

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


Watch video 2.6 Mutual Attraction - The Nature of Code online without registration, duration hours minute second in high quality. This video was added by user The Coding Train 28 March 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 115,298 once and liked it 3.6 thousand people.