This program computes expended agent power vs. time, for an oscillating charge. The maximum speed is selectable by the user.

Private Sub cmdComputePower_Click()

Const c As Double = 299792000# 'Speed of light

'Pick the desired maximum speed.

'Const vmax As Double = 0.001 * c

'Const vmax As Double = 0.9 * c

'Const vmax As Double = 0.999999 * c

Const vmax As Double = 0.999999999999 * c 'Maximum speed of spherical shell

Const Steps As Double = 10000# 'Iterations

Const epsilon0 As Double = 0.00000000000885 'Permittivity constant

Const pi As Double = 3.14159265358979

Const A As Double = 0.0000000001 'Amplitude of oscillation

Const omega As Double = vmax / A 'Angular frequency

Const tau As Double = 2 * pi / omega 'Period of oscillation

MsgBox ("tau = " & tau)

Const deltat As Double = tau / (Steps) 'Time between epochs

Const q As Double = -1.6E-19 'Particle charge

Const alpha As Double = q ^ 2 / (6 * pi * epsilon0 * c ^ 3)

Dim index As Long

Dim Prad(Steps) As Double 'Agent power

Dim t(Steps) As Double 'time

Dim Term1, Term2 As Double

Dim cos1, sin1 As Double

Dim Num, Denom As Double

'For each time epoch...

For index = 0 To Steps - 1

Debug.Print index

'Starting out at x=-A...

t(index) = -tau / 4 + index * deltat

'Compute the expended agent power.

cos1 = Cos(omega * t(index))

sin1 = Sin(omega * t(index))

Num = omega ^ 4 * A ^ 2 * cos1 ^ 2

Denom = (1 - omega ^ 2 * A ^ 2 * cos1 ^ 2 / c ^ 2) ^ 2

If Denom <> 0 Then Term1 = Num / Denom

Num = -3 * omega ^ 6 * A ^ 4 * cos1 ^ 2 * sin1 ^ 2

Denom = c ^ 2 * (1 - omega ^ 2 * A ^ 2 * cos1 ^ 2 / c ^ 2) ^ 3

If Denom <> 0 Then Term2 = Num / Denom

Prad(index) = alpha * (Term1 + Term2)

Next index

'Output the time and power values for plotting.

Open "c:\winmcad\Physics\POSPower.prn" For Output As #1

For index = 0 To Steps - 1

Write #1, t(index), Prad(index)

Next index

Close

MsgBox ("Ready for plotting")

End Sub