Time complexity O(n2)

physik not simple 1/r^2

therefore, finished libraries are not suitable

+ and I do not want someone else's

I will probably correct the laws of interaction between the bodies of the system, so the possibility of further corrections should remain

Code: Select all

` sub vals () `

for n=0 to Nmass

dim as single dx,dy ,a,df,dfy,dfx,xm,ym

dim as single Rglue ,Rgquadro

for m=0 to Nmass

if n<>m then

dx=x(m)-x(n):dy=y(m)-y(n)

Rgquadro=(dx*dx+dy*dy): Rglue=sqr (Rgquadro)

Select Case Rglue

Case is >140

df=9512/((Rgquadro))

Case 10 to 140

df=((-1e12 /Rgquadro)/Rgquadro/Rgquadro)+.4

Case 0 to 10

df=0 : NUM_ERROR=NUM_ERROR+1

x_ERR_m(m) =x(m):x_ERR_m(m) =y(m):

x_ERR_n(n) =x(n):x_ERR_n(n) =y(n):

n_ERR_part =n

m_ERR_part =m

End Select

df=df*mc(m)

dfy=dfy+df*(dy/Rglue):dfx=dfx+df*(dx/Rglue)

end if

next m

dfy=dfy-y(n)*Kcnt:dfx=dfx-x(n) *Kcnt rem Centering power

vy(n)=vy(n)*.99999:vx(n)=vx(n)*.99999 rem dissipation

vy(n)=vy(n)+dfy*dt:vx(n)=vx(n)+dfx*dt

y(n)=y(n)+vy(n)*dt : x(n)=x(n)+vx(n)*dt

dx=x(m)-x(n):dy=y(m)-y(n)

next n

end sub