|
Private Sub Sect4_Click() '*************************************** 'This program computes the positions of particles in frame K', at the single instant 't'=0, on the assumption that the particles are all at rest in frame K. As discussed 'in Sect. 4, this problem can be solved analytically. But the implemented 'algorithm serves as an introduction to cases where the particles are moving '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# 'Speed of light Const v As Double = 0.8 * c 'Speed of K' relative to K Const m As Double = 1000000 'Cuts down on size of deltat Const t As Double = 0 'Initial reading of K-clocks
Dim deltat As Double 'Amount to increase/decrease K-clock reading Dim t1 As Double 'Adjusted time of K-clock Dim tp As Double 'Time of K'-clock Dim x(N) As Double 'x-coordinate of particle in K Dim xp(N) As Double 'x'-coordinate of particle in K' Dim y(N) As Double Dim yp(N) As Double Dim theta(N) As Double 'Angle with negative x-axis in K Dim gamma As Double Dim index As Long
gamma = 1 / Sqr(1 - v ^ 2 / c ^ 2) 'Used in transformations 'Build coordinates in K, and y'-coordinates in K'. For index = 0 To N - 1 theta(index) = 2 * pi * index / N x(index) = R * Cos(theta(index)) y(index) = R * Sin(theta(index)) yp(index) = y(index) Next index 'Creep up to t'=0. For index = 0 To N - 1 tp = -gamma * (t - v * x(index) / c ^ 2) deltat = tp / m t1 = 0 Do t1 = t1 + deltat tp = gamma * (t1 - v * x(index) / c ^ 2) If Abs(tp) < 2 * Abs(deltat) Then Exit Do Loop xp(index) = gamma * (x(index) - v * t1) Next index 'At conclusion, output position coordinates for plotting. 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 |