Skip to content

Add Scalable Three Body Problem Setup#4

Open
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-3
Open

Add Scalable Three Body Problem Setup#4
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-3

Conversation

Copy link
Contributor

Copilot AI commented Aug 11, 2025

This PR implements a new "Three Body Problem" setup for the Gravity Simulator based on Liu Cixin's renowned science fiction series. The setup demonstrates the chaotic nature of gravitational systems with three massive bodies, now optimized with 100x scaling for better observation.

Features Added

New Three Body Problem Setup

  • 3 Suns: Alpha Centauri A (yellow), Alpha Centauri B (orange), and Proxima Centauri (red dwarf)
  • 3 Planets: Trisolaris (the main planet from the novels), Chaotic Inner, and Distant World
  • Optimized Scale: 100x smaller dimensions for closer observation while maintaining realistic physics

Implementation Details

  • Created new ThreeBody class extending the existing Setup abstract class
  • Added import and registration in the main component to make it available in the setup dropdown
  • Used scientifically accurate masses (solar mass ~1.989e30 kg for stars, Earth-like masses for planets)
  • Positioned bodies in a triangular configuration to maximize three-body gravitational interactions

Scaling Applied

  • Distances: Scaled down 100x (baseDistance: 1.5e11 → 1.5e9 m, ~1/100 AU)
  • Radii: Scaled down 100x (sun radius: 6.96e8 → 6.96e6 m, planet radii proportionally)
  • Velocities: Scaled down 10x to maintain orbital dynamics (e.g., 5000 → 500 m/s)
  • Masses: Kept realistic for proper gravitational physics

Demonstrated Behavior

The simulation showcases classic three-body problem characteristics:

  • Chaotic motion: Bodies follow unpredictable, non-repeating orbital paths
  • System instability: High error percentages indicating growing computational uncertainty
  • Natural collisions: Smaller bodies eventually get absorbed by larger ones due to chaotic gravitational interactions
  • Mass conservation: When collisions occur, momentum and mass are properly conserved according to Newtonian physics

The scaled setup provides an excellent demonstration of why the three-body problem has no general analytical solution and must be solved numerically, with small changes in initial conditions leading to vastly different outcomes over time.

Scaled Three Body Problem Setup

Fixes #3.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: GrantErickson <5058658+GrantErickson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Three Body Problem Setup Add Three Body Problem Setup Aug 11, 2025
Copilot AI requested a review from GrantErickson August 11, 2025 20:59
@GrantErickson GrantErickson marked this pull request as ready for review August 12, 2025 16:32
Copy link
Owner

@GrantErickson GrantErickson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you scale, making it 100 times smaller? The velocities and other variables should be adjusted by an appropriate amount.

@GrantErickson
Copy link
Owner

@copilot Can you scale, making it 100 times smaller? The velocities and other variables should be adjusted by an appropriate amount.

… adjustments

Co-authored-by: GrantErickson <5058658+GrantErickson@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 13, 2025

@copilot Can you scale, making it 100 times smaller? The velocities and other variables should be adjusted by an appropriate amount.

The Three Body Problem setup has been scaled down 100x as requested. The changes include:

• Distances scaled down 100x (baseDistance: 1.5e11 → 1.5e9 m)
• Radii scaled down 100x (sun radius: 6.96e8 → 6.96e6 m, planet radii similarly scaled)
• Velocities scaled down 10x to maintain realistic orbital dynamics (e.g., 5000 → 500 m/s)
• Masses kept the same for proper gravitational physics

The scaled system maintains chaotic three-body behavior while being much more compact for easier observation. Commit: 25f4034

Copilot AI changed the title Add Three Body Problem Setup Add Scalable Three Body Problem Setup Aug 13, 2025
Copilot AI requested a review from GrantErickson August 13, 2025 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Three Body Problem Setup

2 participants