5 return sqrt(sum(x * x
for x
in args))
9 collision happens at exactly t= 1.885638833885 for nbod=3
12 integrator =
"hermite_cpu",
16 destination_time = 1.885638833885
18 def createEnsemble(self):
31 s[0].pos = [ 0, 0, 0 ]
32 s[0].vel = [ 0, 0, 0 ]
34 for j
in range(1,ens.nbod):
35 x = ((j % 2)*2-1)*2*((j+1)/2)
37 vmag = sqrt(2*mu/norm(x,y))
38 vdirx = (x/abs(x))/norm(1,x/2/R)
39 vdiry = abs(x)/2/R / norm(1,x/2/R)
40 s[j].pos = [ x, y, 0 ]
41 s[j].vel = [ -vmag*vdirx, -vmag*vdiry, 0 ]
42 s[j].mass = mass_planet
49 print rs[1].pos, rs[2].pos, rs[1].vel, rs[2].vel
50 print s[1].pos, s[2].pos
54 self.assertAlmostEqual(norm(x2-x1,y2-y1,z2-z1),0)