looking at this part of your code
I think what you want is
this way, when i=0, j will take values from 1 to 8
when i=1, j will take values from 2 to 8, etc.
PS. Not sure where the best place for rate(1000000) is...
while True: for i in arange(0,9,1): rate(1000000) t=t+dt rsun = posit[0]-posit[i] if mag(rsun) == 0: continue Fsun = ((G*mass[0]*mass[i])/(mag(rsun)**2))* norm(rsun) #Calculating the force of gravity from the sun rmerc = posit[1]-posit[i] if mag(rmerc)==0: continue Fmerc = ((G*mass[1]*mass[i])/(mag(rmerc)**2))* norm(rmerc) rven = posit[2]-posit[i] if mag(rven)==0: continue Fven = ((G*mass[2]*mass[i])/(mag(rven)**2))* norm(rven) rear = posit[3]-posit[i] if mag(rear)==0: continue Fear = ((G*mass[3]*mass[i])/(mag(rear)**2))* norm(rear) rmars = posit[4]-posit[i] if mag(rmars)==0: continue Fmars = ((G*mass[4]*mass[i])/(mag(rmars)**2))* norm(rmars) rjup = posit[5]-posit[i] if mag(rjup)==0: continue Fjup = ((G*mass[5]*mass[i])/(mag(rjup)**2))* norm(rjup) rsat = posit[6]-posit[i] if mag(rsat)==0: continue Fsat = ((G*mass[6]*mass[i])/(mag(rsat)**2))* norm(rsat) ruran = posit[7]-posit[i] if mag(ruran)==0: continue Furan = ((G*mass[7]*mass[i])/(mag(ruran)**2))* norm(ruran) rnep = posit[8]-posit[i] if mag(rnep)==0: continue Fnep = ((G*mass[8]*mass[i])/(mag(rnep)**2))* norm(rnep) Fnet = Fsun + Fmerc + Fven + Fear + Fmars + Fjup + Fsat + Furan + Fnep acc[i]=Fnet/mass[i] vel[i]=vel[i] + acc[i]*dt posit[i]=posit[i] + vel[i]*dtNot 100% sure, but it looks like it will never calculate anything - you loop over all objects so at least one mag will be 0, so it will continue with next i, without even reaching
Fnet = Fsun + Fmerc + Fven + Fear + Fmars + Fjup + Fsat + Furan + Fnep
and next lines. Not to mention repeating codeI think what you want is
while True: for i in arange(0,9,1): Fnet = 0 for j in range(i+1,9,1): rate(1000000) t=t+dt r = posit[j]-posit[i] F = ((G*mass[j]*mass[i])/(mag(r)**2))* norm(r) #Calculating the force of gravity from object j over object i Fnet += F acc[i]=Fnet/mass[i] vel[i]=vel[i] + acc[i]*dt posit[i]=posit[i] + vel[i]*dt sun.pos=posit[0] mercury.pos=posit[1] venus.pos=posit[2] earth.pos=posit[3] mars.pos=posit[4] jupiter.pos=posit[5] saturn.pos=posit[6] uranus.pos=posit[7] neptune.pos=posit[8]
this way, when i=0, j will take values from 1 to 8
when i=1, j will take values from 2 to 8, etc.
PS. Not sure where the best place for rate(1000000) is...