# Which is more useful? Instantaneous rate of change of displacement or Average rate of change of displacement?

Instantaneous rate of change of displacement is given by,

v(t) = (s(t + dt) - s(t))/dt, where dt tends to 0


while average rate of change of displacement is given by,

v(t) = (s(t[n]) - s(t[n-1]))/(t[n] - t[n-1])


The first one gives the slope or derivative of a displacement function at a particular instant of time and thus varies with time. I was wondering how is it going to help me calculate the velocity of my robot's end effector, which is the foot of the leg of the robot(bipedal). If i make a reading of the position of the robot every 1ms to keep the approximation as accurate as possible, my instantaneous velocity would be zero wouldn't it? Since my robot wouldn't have moved anywhere in 1ms time. Agreed, 't' would increment as t+dt, dt == 0.001s. Then v(t) would be v(0.001) = s(0.002) - s(0.001) which is zero, because there is no displacement in that small time frame, right? Am I doing something wrong here? Or on the other hand, do I just use average rate of change? I have this question, since, if there is a manipulator, in my case the foot of my robot, and it's trajectory is given by a 3x3 homogenous matrix,

[{c(t),-s(t), 0},
{s(t), c(t), 0},
{  0,    0,  1}], where c,s are cos(theta) and sin(theta)respectively,


if on paper, this is differentiated, this would give me a spatial/body velocity matrix as

[{0, -d(theta)/dt, 0},
{d(theta)/dt,  0, 0},
{    0,        0, 0}]


So how do I compute this differentiation in code. I just need something of the sort of a pseudocode.