I want to track the path of particles for one hour by solving the equation of motion. I generate multiple points in time:
t = np. arange(0,3600,10)
.
Does the time duration depends on the time step?
If we write the times as t = np.arange(0,3600,0.2)
, will we still get a vector of time samples which reflects one hour?
If you use the numpy.arange(start=0,stop=3600,step,...)
the duration of your measurement does not equal one hour. This fact is caused by the half-open interval [start, stop) which is used to generate your vector (Note: Your stop value is not included in the generated vector. Thus, the duration does not equal stop - start). If you really want your measurement duration to equal one hour you can use numpy.linspace(...,endpoint=True)
.
import numpy as np
start = 40 # Start in seconds [s]
stop = 3600 # Stop in seconds [s]
N = 3 # Number of samples (N must not be 1)
t = np.linspace(start, stop, N, endpoint=True)
D = t[-1] - t[0]