I want to implement a physical expression in python which contains time derivatives. The equation has terms like x * dx/dt, i.e. it multiplies an array with its time derivative (x is a 1-dim np.array). My question is, what is the best option for carrying out such operations? I tried np.diff(), but my main concern is that the length of dx will be less than the length of x by one, and hence the last element of x has to be left out.
Asked
Active
Viewed 37 times
0
-
Can you provide a small example of your input (i.e., `x`) and the expected output? Your reference to `np.diff()` makes me think you may be working with time series data and wanting to compute differences between lags. – blueogive Oct 22 '22 at 19:31