Taking nth Derivatives of x(t)

i is not used inside the loop because it is just computing the nth derivative by differentiating the previous value of dx.