diff --git a/lib/objects.py b/lib/objects.py index 50df1f2..6ba8418 100755 --- a/lib/objects.py +++ b/lib/objects.py @@ -100,14 +100,16 @@ class System: def Update_a(self): #update acceleration of bodies in system for body in self.bodylist: + body.a = np.zeros(3) for otherbody in self.bodylist: if body != otherbody: rij = np.linalg.norm(body.q-otherbody.q) - body.a = body.a - (body.q-otherbody.q)*G*otherbody.m/(rij**2) + body.a = body.a - (body.q-otherbody.q)*G*otherbody.m/(rij**3) return 1 def Update_j(self): #update jerk of bodies in system for body in self.bodylist: + body.j = np.zeros(3) for otherbody in self.bodylist: if body != otherbody: rij = np.linalg.norm(body.q-otherbody.q) @@ -121,18 +123,21 @@ class System: for body in self.bodylist: body.qp = body.q +dt*body.v+((dt**2)*body.a/2.)+((dt**3)*body.j/6.) body.vp = body.v + dt*body.a + ((dt**2)*body.j/2.) + #print("v=",body.v," vp=" ,body.vp) return 1 def Update_ap(self): #update acceleration of bodies in system for body in self.bodylist: + body.ap = np.zeros(3) for otherbody in self.bodylist: if body != otherbody: rij = np.linalg.norm(body.qp-otherbody.qp) - body.ap = body.ap - (body.qp-otherbody.qp)*G*otherbody.m/(rij**2) + body.ap = body.ap - (body.qp-otherbody.qp)*G*otherbody.m/(rij**3) return 1 def Update_jp(self): #update jerk of bodies in system for body in self.bodylist: + body.jp = np.zeros(3) for otherbody in self.bodylist: if body != otherbody: rij = np.linalg.norm(body.qp-otherbody.qp) diff --git a/main.py b/main.py index 2ea9c9e..0d11c0e 100755 --- a/main.py +++ b/main.py @@ -34,8 +34,8 @@ def main(): dyn_syst.COMShift() duration, step = 100*3e7, 1e4 - E, L = frogleap(duration, step, dyn_syst, recover_param=True)#, display=True) - E, L = dyn_syst.hermite(duration,step, recover_param=True, display=True) + #E, L = frogleap(duration, step, dyn_syst, recover_param=True)#, display=True) + E, L = dyn_syst.hermite(duration,step, recover_param=True)#, display=True) fig1 = plt.figure(figsize=(30,15)) ax1 = fig1.add_subplot(111) diff --git a/plots/Em.png b/plots/Em.png index d599d3a..db9d12a 100644 Binary files a/plots/Em.png and b/plots/Em.png differ diff --git a/plots/L2.png b/plots/L2.png index fb3e3d9..347d221 100644 Binary files a/plots/L2.png and b/plots/L2.png differ