Skip to content

Creating and Training a ANN for solving the choatic 3 body problem

Notifications You must be signed in to change notification settings

DarkFalcon626/ANN-for-3-body-problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solving the 3 body gravitational problem using ANN

Overview

This projects objection is to build and train an artificial neural network to solve the famous 3 body gravitational problem. Due to the chaotic nature of the 3 body problem no close form solution exists to the problem. With the power of computers came aproximate solutions using methods such as the Runge-Kutta methods for solving systems of ODEs, now with the raise of neural networks we again make advancements in solving the 3 body problem.

This projects focus is on a restricted version of the 3 body problem in which two of the bodies are static and the motion of the third much smaller body is what we aim to solve for. We set the problem up to model an asteroid traveling through or entering the earth and moon system.

Set Up of the Problem

We set up our problem with the earth at the origin of the system (i.e (0,0)) with a mass of $M_{E}=5.9722*10^{24}$ and the moon resting on the y-axis at a distance of $d_{m} = 3.84*10^{8}$ with a mass of $M_{M}=7.35*10^{22}$.

The problem is described by the second order differential equation for the acceleration of the asteroid,

$$\frac{d^{2}\vec{x}}{dt^{2}} = G\biggl(\frac{m_{E}}{||\vec{x}||^{3}}\vec{x}+\frac{m_{M}}{||\vec{x}-\vec{x_{M}}||^{3}}(\vec{x}-\vec{x_{M}})\biggr)$$

This equation can be turned into two first order differential equations by making the substatution $\vec{u}=\frac{d\vec{x}}{dt}$, this gives us the following,

$$\frac{d\vec{u}}{dt} = G\biggl(\frac{m_{E}}{||\vec{x}||^{3}}\vec{x}+\frac{m_{M}}{||\vec{x}-\vec{x_{M}}||^{3}}(\vec{x}-\vec{x_{M}})\biggr)$$ $$\frac{d\vec{x}}{dt} = \vec{u}.$$

Next we nondimensionalize the above equations using the mass of earth as the characteristic mass and the distance between earth and the moon and the characteristic lenght. Using the characteristic mass, lenght and the gravitational constant we can find an expression for the characteristic time.

$$T=\sqrt{\frac{L^{3}}{GM}}$$

Thus we can write out the following $\vec{x}=L\vec{r}</code>, $<code>m_{E}=Mn_{E}$, $m_{M}=Mn_{M}$, $t=T\tau$, and $\vec{u}=(L/T)\vec{v}$. Using this we get,

$$\frac{GML}{L^{3}}\frac{d\vec{v}}{d\tau}=\frac{GML}{L^{3}}\biggl(\frac{\vec{r}}{||\vec{r}||^{3}}+\frac{n_{M}}{||\vec{r}-\vec{r}_{M}||^{3}}(\vec{r}-\vec{r}_{M})\biggr)$$ $$\frac{L}{T}\frac{d\vec{r}}{d\tau}=\frac{L}{T}\vec{v}$$

This simplifies to,

$$\frac{d\vec{v}}{d\tau}=\biggl(\frac{\vec{r}}{||\vec{r}||^{3}}+\frac{n_{M}}{||\vec{r}-\vec{r}_{M}||^{3}}(\vec{r}-\vec{r}_{M})\biggr)$$ $$\frac{d\vec{r}}{d\tau}=\vec{v}$$

A solution to the above equation does not exist in a closed form solution, A Numeretical solution can be found using computer algorithms such as the 4th order Runge-Kutta method. These methods can be quite computationally expensive to run and only build solutions step by step not allowing us to put in a set of inputs (i.e $\vec{x}$) and get the solution (i.e $\vec{y}$) as we would be able to if we knew the function $f(\vec{x})=\vec{y}$, this is where our project comes into play.

Using the universal approximation theorem which is stated below, we can train a artifical neural network $N(t,\vec{x}_{0}, \vec{v}_{0})$ to approximate the solution to the above equations.

UATScreenshot

Creating The Network

To solve the problem we use a artifical neural network to approximate the solution to the restricted 3 body problem. In our network we use an input layer with 5 neurons for both the $x$ and $y$ initial coordinates, the $v_{x}$ and $v_{y}$ initial velocity coordinates, and $t$ the time we want the coordates at. we then run these through 3 hidden layers with a tanh activation function leading to an output layer of 2 neurons with a linear activation function for the position coordinates $x$ and $y$. An image of this network is given below. NetworkImg

Creating the Datasets

In order to train our model we use a supravisied learning method, to do this we require a dataset to give our network a target to determine how the model is preforming and how the models parameters should be updated.

Releases

No releases published

Packages

No packages published

Languages