Math macro command for latex support in markdown
Number and Arrays
command | visualization | comment | |
---|---|---|---|
a |
A scalar | ||
\va |
A vector, additionally \vzero, \vone, \vmu, \vnu, \vtheta |
||
\mA |
A matrix | ||
\tA |
A tensor | ||
\mI_n |
Identity matrix with |
||
\mI |
Identity matrix with dimensionality implied by context | ||
\ve^{(i)} |
Standard basis vector |
||
\text{diag}(\va) |
A square, diagonal matrix with diagonal entries given by |
||
\ra |
A scalar-valued random variable | ||
\rva |
A vector-valued random variables | ||
\rmA |
A matrix-valued random varialbes |
Sets and Graphs
Command | Visualization | Comment |
---|---|---|
\sA |
A set Note: the command covers sA to sZ but don't no sE since it's expectation |
|
\R |
The set of real numbers | |
{0, 1} |
The set containing 0 and 1 | |
{0, 1, \dots, n} |
The set of all integers between |
|
[a, b] |
The real interval including |
|
(a, b] |
The real interval excluding |
|
\sA \backslash \sB |
Set subtraction, i.e., the set containing the elements of |
|
\gG |
A graph |
Indexing
Command | Visualization | Comment |
---|---|---|
\eva_i |
Element |
|
\eva_{-i} |
All elements of vector |
|
\emA_{i,j} |
Element |
|
\mA_{i, :} |
Row |
|
\mA_{:, i} |
Column |
|
\etA_{i, j, k} |
Element |
|
\tA_{:, :, i} |
2-D slice of a 3-D tensor | |
\erva_i |
Element |
Linear Algebra Operators
Command | Visualization | Comment |
---|---|---|
\mA^\top |
Transpose of matrix |
|
\mA^+ |
Moore-Penrose pseudoinverse of |
|
\mA \odot \mB |
Element-wise (Hadamard) product of |
|
\mathrm{det}(\mA) |
Determinant of |
|
\sign(x) |
Sign of a variable |
|
\Tr \mA |
Trace of a matrix A |
Calculus
Command | Visualization | Comment |
---|---|---|
\diff y / \diff x |
Derivative of |
|
\frac{\partial y}{\partial x} |
Partial derivative of |
|
\nabla_\vx y |
Gradient of |
|
\nabla_\mX y |
Matrix derivatives of |
|
\nabla_\tX y |
Tensor containing derivatives of |
|
\frac{\partial f}{\partial \vx} |
Jacobian matrix |
|
\nabla_\vx^2 f(\vx)\text{ or }\mH(f)(\vx) |
The Hessian matrix of |
|
\int f(\vx) d\vx |
Definite integral over the entire domain of |
|
\int_\sS f(\vx) d\vx |
Definite integral with respect to |
Probabilities
Command | Visualization | Comment |
---|---|---|
\ra \bot \rb |
The random variables |
|
\ra \bot \rb \mid \rc |
They are conditionally independent given |
|
P(\ra) |
A probability distribution over a discrete variable | |
p(\ra) |
A probability distribution over a continuous variable, or a variable of unspecified type | |
\ra \sim P |
Random variable |
|
\E_{\rx \sim P} [ f(x) ] \text{ or } \E f(x) |
Expectation of |
|
\Var(f(x)) |
Variance of |
|
\Cov(f(x), g(x)) |
Covariance of |
|
H(\rx) |
Shannon entropy of the random variable |
|
\KL(P \Vert Q) |
Kullback-Leibler divergence of |
|
\mathcal{N}(\vx ; \vmu , \mSigma) |
Gaussian distribution over |
Functions
Command | Visualization | Comment |
---|---|---|
f: \sA \rightarrow \sB |
The function |
|
f \circ g |
Composition of the functions |
|
f(\vx ; \vtheta) |
A function of |
|
\log x |
Natural logarithm of |
|
\sigma(x) |
Logistic sigmoid, |
|
\zeta(x) |
Softplus, |
|
\Vert \vx \Vert_p |
||
\Vert \vx \Vert |
||
x^+ |
Positive part of |
|
\bm{1}_\mathrm{condition} |
Is 1 if the condition is true, 0 otherwise |
Custom Commands special
Command | Visualization | Comment |
---|---|---|
\bm{#1} |
Bold symbol, e.g., |
|
\sign |
operator, Sign , |
|
\Tr |
operator Trace, |
|
\E |
Expectation, |
|
\KL |
Kullback-Leibler divergence, |
|
\NormalDist |
Gaussian distribution, |
|
\diag |
Diagonal matrix, |
|
\Ls |
Loss function, |
|
\R |
Real number set, |
|
\emp |
Empirical distribution, |
|
\lr |
Learning rate, |
|
\reg |
Regularization coefficient, |
|
\rect |
Rectifier activation, |
|
\softmax |
Softmax function, |
|
\sigmoid |
Sigmoid function, |
|
\softplus |
Softplus function, |
|
\Var |
Variance, |
|
\standarderror |
Standard error, |
|
\Cov |
Covariance, |
|
\tran |
Transpose operator, |
|
\inv |
Inverse operator, |
|
\diff |
Differential operator, |
Reference
- Ian Goodfellow's ML book: https://github.com/goodfeli/dlbook_notation/blob/master/notation_example.pdf
- MathJax: https://docs.mathjax.org/en/latest/input/tex/macros.html
No Comments