Example
In the theory of relativity, time dilation refers to the difference in elapsed time as measured by two observers due to a relative velocity between them or the presence of a gravitational field.
The formula for time dilation due to relative velocity is:
$$
\Delta t’ = \frac{\Delta t}{\sqrt{1 - \frac{v^2}{c^2}}}
$$
- $ \Delta t $:
Proper time (time measured in the rest frame of the object). - $ \Delta t’ $:
Dilated time (time measured by a moving observer). - $ v $:
Velocity of the moving object. - $ c $:
Speed of light $( 3 \times 10^8 \ \text{m/s} )$.
Problem Statement
A spaceship is moving at different fractions of the speed of light $( v/c )$.
Compute the time dilation for a proper time of $1$ second as observed in the spaceship’s rest frame.
Visualize the relationship between the velocity fraction $( v/c )$ and the dilated time.
Python Code
1 | import numpy as np |
Code Explanation
Constants:
- The speed of light $( c )$ is set to $ 3 \times 10^8 \text{m/s} $.
- The proper time $( \Delta t )$ is set to $1$ second.
Velocity Fractions:
- We create an array of velocity fractions $( v/c )$ ranging from $0$ to $0.99$.
The value $0.99$ is chosen to avoid the singularity at $( v = c )$.
- We create an array of velocity fractions $( v/c )$ ranging from $0$ to $0.99$.
Dilated Time Calculation:
- Using the time dilation formula, the dilated time is calculated for each velocity fraction.
Visualization:
- A graph is plotted with the velocity fraction $( v/c )$ on the $x$-axis and the dilated time $( \Delta t’ )$ on the $y$-axis.
- The proper time ($1$ second) is shown as a reference line.
Graph Explanation

- $x$-axis: Represents the velocity fraction $( v/c )$.
- $y$-axis: Represents the dilated time $( \Delta t’ )$.
- As the velocity approaches the speed of light $( v/c \to 1 )$, the dilated time $( \Delta t’ )$ increases dramatically, illustrating the effect of time dilation.
- The red dashed line represents the proper time of $1$ second.
For low velocities $( v/c \approx 0 )$, the dilated time is almost equal to the proper time.
Results
- At $ v/c = 0.1 $, the dilated time is approximately $ 1.005 \text{s} $.
- At $ v/c = 0.9 $, the dilated time is approximately $ 2.294 \text{s} $.
- As $ v/c \to 1 $, the dilated time tends to infinity, showing the extreme effects of relativistic speeds.









