Dear all, I have a matrix like this, M<- array(runif(100,-1,1), dim=c(10,10)); I want to get the gradient of M in a new 10 by 10 matrix say Mgrad. Seemingly, the command like numericDeriv(expr, theta, rho = parent.frame(), dir = 1) does not work in such a case since I can not give an "expr". Thank, Best, Bai