Function Repository Resource:

TotalVariation

Source Notebook

Get the total variation of a matrix

Contributed by: Wolfram Research

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 (2) 

TotalVariation 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 (2) 

TotalVariation 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]=

TotalVariation is equivalent to the sum of column variances:

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

Options (1) 

Use the maximum likelihood estimation:

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

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 06 February 2019

Related Resources

License Information