Simulating the Special Theory of Relativity requires a deep understanding of the concepts and mathematics involved. However, here is a simple program in Python that demonstrates time dilation, one of the key predictions of the theory:
makefileCopy codeimport math
# Constants
c = 299792458 # speed of light in meters per second
v = 0.8 * c # velocity of object in meters per second
t = 10 # time elapsed for stationary observer in seconds
# Calculate time dilation
t_prime = t / math.sqrt(1 - (v**2 / c**2))
# Output results
print("Time elapsed for stationary observer: ", t, "seconds")
print("Time elapsed for moving observer: ", t_prime, "seconds")
This program calculates the time elapsed for a stationary observer and a moving observer traveling at 80% of the speed of light. The calculation takes into account time dilation, which is the phenomenon of time appearing to slow down for objects in motion relative to an observer at rest.
Note that this is a simplified example and does not take into account other important concepts from the theory, such as length contraction or the equivalence of mass and energy