Wolfram Research

TotalVariation

Contributed by: Wolfram Research

Source Notebook

Get the total variation of a matrix

ResourceFunction["TotalVariation"][matrix]

gives the total variation for matrix.

Details and Options

ResourceFunction["TotalVariation"][matrix] effectively gives the trace of the covariance matrix for matrix.
ResourceFunction["TotalVariation"][matrix] is equivalent to Total[Variance[matrix]].

Examples

Basic Examples

Total variation of bivariate data:

In[1]:=
ResourceFunction["TotalVariation"][{{a, b}, {c, d}, {e, f}}]
Out[1]=

Assume all symbols are real and simplify:

In[2]:=
Simplify[ComplexExpand[%]]
Out[2]=

Properties & Relations

Total variation is equivalent to the trace of the covariance matrix:

In[3]:=
ResourceFunction["TotalVariation"][{{1, 0}, {0, 2}, {3, 4}, {4, 2}}]
Out[3]=
In[4]:=
Tr[Covariance[{{1, 0}, {0, 2}, {3, 4}, {4, 2}}]]
Out[4]=

Total variation is equivalent to the sum of column variances:

In[5]:=
Total[Variance[{{1, 0}, {0, 2}, {3, 4}, {4, 2}}]]
Out[5]=

Options

Use the maximum likelihood estimation:

In[6]:=
ResourceFunction["TotalVariation"][{{1, 0}, {0, 2}, {3, 4}, {4, 2}}, MLE -> True]
Out[6]=

Resource History

See Also