{"id":25236757,"url":"https://github.com/scorleos773/three-body-problem-simulator","last_synced_at":"2026-05-02T04:36:54.711Z","repository":{"id":276964470,"uuid":"930878364","full_name":"SCORLEOs773/Three-Body-Problem-Simulator","owner":"SCORLEOs773","description":"Three-Body Problem Simulation - A Python-based simulation of the Three-Body Problem with both 2D and 3D visualizations. Uses `matplotlib` and `scipy` to model gravitational interactions and animate orbital trajectories. 🚀🔭","archived":false,"fork":false,"pushed_at":"2025-02-11T11:39:39.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T18:13:20.782Z","etag":null,"topics":["differential-equations","matplotlib","mplot3d","newtonian-mechanics","numerical-integration","numpy","orbital-mechanics","python","runge-kutta-methods","scipy-integrate","three-body-problem","three-body-simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SCORLEOs773.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-11T11:08:23.000Z","updated_at":"2025-02-11T11:44:00.000Z","dependencies_parsed_at":"2025-02-11T12:25:27.666Z","dependency_job_id":"3587c6b9-8f1e-4e06-a48c-f8398fef4436","html_url":"https://github.com/SCORLEOs773/Three-Body-Problem-Simulator","commit_stats":null,"previous_names":["scorleos773/three-body-problem-simulator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCORLEOs773%2FThree-Body-Problem-Simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCORLEOs773%2FThree-Body-Problem-Simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCORLEOs773%2FThree-Body-Problem-Simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SCORLEOs773%2FThree-Body-Problem-Simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SCORLEOs773","download_url":"https://codeload.github.com/SCORLEOs773/Three-Body-Problem-Simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378145,"owners_count":20929297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["differential-equations","matplotlib","mplot3d","newtonian-mechanics","numerical-integration","numpy","orbital-mechanics","python","runge-kutta-methods","scipy-integrate","three-body-problem","three-body-simulation"],"created_at":"2025-02-11T15:31:49.119Z","updated_at":"2026-05-02T04:36:54.685Z","avatar_url":"https://github.com/SCORLEOs773.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Three-Body Problem Simulation\r\n\r\nThis repository contains Python implementations of the **Three-Body Problem**, a classical problem in celestial mechanics that involves predicting the motion of three bodies under mutual gravitational attraction. The simulations are available in both **2D** and **3D** versions.\r\n\r\n## Features\r\n- **2D Simulation**: Visualizes the orbits of three bodies in a 2D plane.\r\n- **3D Simulation**: Adds depth and realism by simulating the bodies in three-dimensional space.\r\n- **Custom Initial Conditions**: Modify mass, velocity, and starting positions for different scenarios.\r\n- **Animated Trajectories**: Real-time visualization using `matplotlib.animation`.\r\n\r\n---\r\n\r\n## 🛠 Installation\r\n\r\n1. Clone this repository:\r\n   ```sh\r\n   git clone https://github.com/yourusername/three-body-simulation.git\r\n   cd three-body-simulation\r\n\r\n2. Install the required dependencies:\r\n   ```sh\r\n   pip install numpy matplotlib scipy\r\n\r\n3. Run the simulation:\r\n      a. 2D Version:\r\n      ```sh\r\n      python three_body_2d.py\r\n      ```\r\n      b. 3D Version:\r\n      ```sh\r\n      python three_body_3d.py\r\n      \r\n---\r\n\r\n## 📜 How It Works\r\n\r\n### Equations of Motion\r\nThe system is governed by Newton's law of universal gravitation:\r\n\r\n$$ F = \\frac{G m_1 m_2}{r^2} $$\r\n\r\nFor each body, acceleration is computed as:\r\n\r\n$$ a = \\frac{F}{m} $$\r\n\r\nWhere G is the gravitational constant, 𝑚 is mass, and 𝑟 is the distance between bodies.\r\n\r\n### Integration Method\r\nThe code uses scipy.integrate.solve_ivp with the RK45 method to numerically solve the system of differential equations.\r\n\r\n---\r\n\r\n## 🎮 Usage\r\n\r\n### Changing Initial Conditions\r\nYou can modify the starting positions and velocities of the bodies inside the Python files:\r\n\r\n```sh\r\ninitial_conditions = [\r\n    -1, 0, 0, 0, -0.5, 0,  # Body 1\r\n    1, 0, 0, 0, 0.5, 0,    # Body 2\r\n    0, 1, 0, 0.5, -0.5, 0  # Body 3\r\n]\r\nmasses = [1, 1.5, 2]  # Different masses\r\n```\r\nAdjusting these values can create different orbital behaviors.\r\n\r\n---\r\n\r\n## 📌 Todo / Future Improvements\r\n1. Add energy conservation checks.\r\n2. Implement a GUI for user-friendly interaction.\r\n3. Optimize performance for longer simulations.\r\n\r\n---\r\n\r\n## 💡 References\r\n1. Newtonian Mechanics \u0026 Three-Body Problem: Wikipedia\r\n2. matplotlib animations: Matplotlib Do\r\n\r\n---\r\n\r\n## 📜 License\r\n\r\nThis project is open-source and licensed under the MIT License.\r\n📩 Feel free to contribute and improve this simulation!\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscorleos773%2Fthree-body-problem-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscorleos773%2Fthree-body-problem-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscorleos773%2Fthree-body-problem-simulator/lists"}