# Matrix Calculus

MatrixCalculus provides matrix calculus for everyone. It is an online tool that computes vector and matrix derivatives (matrix calculus).

derivative of
w.r.t.

$${}$$

where

• {{v.name}} is a
Export functions as
Common subexpressions
{{ctrl.service.error.msg}}
0.5*x'*A*x
A*exp(x)
sin(x)'*y
(y.*v)'*x
a^b
norm2(A*x-y)^2
sum(log(exp(-y.*(X*w)) + vector(1)))
tr(A*X'*B*X*C)
log(det(inv(X)))

+
-
subtraction
*
multiplication
/
division
^
power

#### Element-wise Operators

.*
element-wise multiplication
./
element-wise division
.^
element-wise power
sin()
element-wise sin
cos()
element-wise cos
tan()
element-wise tan
arcsin()
element-wise arcsin
arccos()
element-wise arccos
arctan()
element-wise arctan
log()
element-wise natural log
exp()
element-wise exp
tanh()
element-wise tanh
abs()
element-wise absolute value
sign()
element-wise sign
relu()
element-wise relu

#### Special Operators on Matrices

sum()
sum of all entries
norm1()
element-wise 1-norm
norm2()
Frobenius norm
tr()
trace
det()
determinant
inv()
inverse

#### Special Operators on Vectors

sum()
sum of all entries
norm1()
1-norm
norm2()
Euclidean norm

#### Special Operators on Scalars

vector()
constant vector
matrix()
constant matrix
###### Cannot display this 3rd/4th order tensor.
Only scalars, vectors, and matrices are displayed as output. If the derivative is a higher order tensor it will be computed but it cannot be displayed in matrix notation. Sometimes higher order tensors are represented using Kronecker products. However, this can be ambiguous in some cases. Here, only in unambiguous cases the result is displayed using Kronecker products. The python code still works on the true higher order tensors.

If you are interested in solving optimization problems easily, you can check out the online tool geno-project.org.

Last updated October 2020.
Due to numerous requests, we have updated the layout convention! We use mixed layout now. For more details, please see the documentation.