Private Sub Sect5_Click()

'******************************************************

'This program computes the K'-coordinates of particles at the single

'instant t'=0, when the particles move in frame K.

'******************************************************

Const pi As Double = 3.141592654

Const R As Double = 1 'Radius of circular contour in frame K

Const N As Double = 8 'Number of particles

Const c As Double = 300000000#

Const v As Double = 0.8 * c

Const u As Double = v

Const omega = u / R

Const m As Double = 1000000

Const t As Double = 0

 

Dim deltat As Double

Dim t1, tp As Double

Dim x(N), xAdj(N) As Double

Dim xp(N) As Double

Dim y(N), yAdj(N) As Double

Dim yp(N) As Double

Dim theta(N) As Double

Dim gamma As Double

Dim index As Long

 

gamma = 1 / Sqr(1 - v ^ 2 / c ^ 2) 'Used in transformations

For index = 0 To N - 1

theta(index) = 2 * pi * index / N

x(index) = R * Cos(theta(index))

y(index) = R * Sin(theta(index))

Next index

For index = 0 To N - 1

tp = gamma * (t - v * x(index) / c ^ 2)

deltat = -tp / m

t1 = 0

Do

t1 = t1 + deltat

xAdj(index) = R * Cos(theta(index) + omega * t1)

yAdj(index) = R * Sin(theta(index) + omega * t1)

tp = gamma * (t1 - v * xAdj(index) / c ^ 2)

If Abs(tp) < 2 * Abs(deltat) Then Exit Do

Loop

xp(index) = gamma * (xAdj(index) - v * t1)

yp(index) = yAdj(index)

Next index

Open "c:\WINMCAD\Physics\Polarization.prn" For Output As #1

For index = 0 To N - 1

Write #1, xp(index), x(index), yp(index), y(index)

Next index

Close

MsgBox ("Ready for plotting")

End Sub