Program 21: Virial Theorem with n objects

Introduction and Purpose

The purpose of the program VIRIALTH.BAS is to demonstrate the Virial Theorem .
To download a copy select: VIRIALTH.BAS
To see the listing of the program select: VIRIALTH.HTM

Description and Operation

The program is based around Newton's Law.
Input to the program are three parameters: N, "Reff at t0" and Random. Accordingly to Newton's Law when the distance is zero the Force increases to infity. In order to prevent this to happen and to keep the speed reasonable the acceleration is set to set to zero, when the distance between two objects becomes small (<0.3),
When the distance of an object is further away than Reff and when the speed of the object is larger (Factor 1.5) than the escape velocity the object is not used any more in the calculation of Reff and the value n (number of objects) is decreased with 1.
In some cases it is still possible that the speed decreases thereafter below the escape velocity and then n is increased.

The simulation consists of two parts: Initialisation and Actual.




Original 6 December 2005

Back to my home page: Contents of This Document