B.7 Simple mathematical functions
The following statements are used to transform data contained in matrices or datasets.
Syntax  Arguments and performed function 
W = exp(X);  W is a matrix with entries equal to the exponentials of the entries of X. The function works elementwise.

W = log(X);  W is a matrix with entries equal to the natural logarithms of the entries of X. The function works elementwise.

W = sqrt(X);  W is a matrix with entries equal to the square roots of the entries of X. The function works elementwise.

W = abs(X);  W is a matrix with entries equal to the absolute values of the entries of X. The function works elementwise.

W = mod(X, Y);  W is a matrix with entries equal to modula of the elementwise division X./Y

W = sin(X);  W is a matrix with entries equal to the sines of the entries of X. The function works elementwise.

W = cos(X);  W is a matrix with entries equal to cosines of the entries of X. The function works elementwise.

W = tan(X);  W is a matrix with entries equal to the tangents of the entries of X. The function works elementwise.

W = asin(X);  W is a matrix with entries equal to the arcsines of the entries of X. The function works elementwise.

W = acos(X);  W is a matrix with entries equal to the arccosines of the entries of X. The function works elementwise.

W = atan(X);  W is a matrix with entries equal to the arctangents of the entries of X. The function works elementwise.

W = inv(X);  W is the inverse of X.

W = invpd(X);  W is the inverse of X, where X is symmetric and positive deﬁnite. This function works faster and is more precise than the general inv() function, taking advantage of the structure of X.

W = det(X);  W is an $1\phantom{\rule{0.3em}{0ex}}\times \phantom{\rule{0.3em}{0ex}}1$ matrix with value equal to the determinant of X.

W = trace(X);  W is an $1\phantom{\rule{0.3em}{0ex}}\times \phantom{\rule{0.3em}{0ex}}1$ matrix with value equal to the trace of X.

W = diag(X);  The function’s return value depends on the size of X:
