# 3-Body Simulation

3-Body Simulation that looks like a sword: from visual import* R= 6.378e6 G=6.67e-11 M1= 6.0e24 M2= M1 M3= M1 r1= vector(10*R,-10*R,0) r2= vector(20*R,0,0) r3= vector(0,0,0) object1= sphere(pos=(r1), radius=R, color=color.white, make_trail=True, trail_type=”points”, interval=10) object2= sphere(pos=(r2), radius=R, color=color.yellow, make_trail=True, trail_type=”points”, interval=10) object3= sphere(pos=(r3), radius=R, color=color.red, make_trail=True, trail_type=”points”, interval=10) v1= vector(0,0,0) v2= v1 v3= v1 v_characteristic= sqrt(G*M1/mag(r1-r2)) T = mag(r1-r2)/v_characteristic dt = 0.0001*T p_object1=M1*v1 p_object2=M2*v2 p_object3=M3*v3 t=0 small= … Continue reading 3-Body Simulation