1
0

Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Alex_Hubert
2021-10-22 16:51:54 +02:00
4 changed files with 36 additions and 32 deletions

View File

@@ -24,6 +24,15 @@ class System:
def __init__(self, bodylist):
self.bodylist = bodylist
def get_masses(self): #return the masses of each object
return np.array([body.m for body in self.bodylist])
def get_positions(self): #return the positions of the bodies
return np.array([body.q for body in self.bodylist])
def get_momenta(self): #return the momenta of the bodies
return np.array([body.p for body in self.bodylist])
def Mass(self): #return total system mass
mass = 0
@@ -65,6 +74,7 @@ class System:
L = L + np.cross(comq[i],body.p)
i = i+1
return L
def Eval(self,Lbodylist): #return total energy of bodies in bodylist
G = 1. #Gravitational constant (here normalized)
T = 0