Function Repository Resource:

MatrixFieldOfValues

Source Notebook

Evaluate the boundary curve of the field of values of a matrix

Contributed by: Jan Mangaldan

ResourceFunction["MatrixFieldOfValues"][m,t]

evaluates the boundary curve of the field of values for a numerical square matrix m at t.

Details

The field of values is also known as the numerical range of a matrix.
The field of values of a square matrix m is the nonempty bounded convex set in the complex plane consisting of all the Rayleigh quotients of m; that is, all the numbers of the form Conjugate[v].m.v, where v is a unit vector.
The unit vector v corresponding to the point returned by ResourceFunction["MatrixFieldOfValues"][m,t] is the eigenvector corresponding to the largest eigenvalue of the Hermitian matrix (g+ConjugateTranspose[g])/2, where g=mExp[t].
SparseArray objects can be used in ResourceFunction["MatrixFieldOfValues"].

Examples

Basic Examples (2) 

Compute a point on the boundary curve of the field of values for a matrix:

In[1]:=
ResourceFunction["MatrixFieldOfValues"][{{1, 2}, {0, 3}}, 0.5]
Out[1]=

A square matrix:

In[2]:=
mat = {{0, 1, 0, 0}, {0, 0, -2, 0}, {0, 0, 0, 3}, {-4, 0, 0, 0}};

Visualize the field of values of the matrix along with its eigenvalues:

In[3]:=
Show[ParametricPlot[
  ReIm[ResourceFunction["MatrixFieldOfValues"][mat, t]], {t, 0, 2 \[Pi]}, Axes -> None, Frame -> True],
 ComplexListPlot[Eigenvalues[N[mat]], PlotMarkers -> {"+", Large}, PlotStyle -> ColorData[97, 4]]]
Out[3]=

Scope (3) 

Evaluate MatrixFieldOfValues for a numerical matrix and a numerical value:

In[4]:=
mat = RandomVariate[NormalDistribution[], {5, 5}];
ResourceFunction["MatrixFieldOfValues"][mat, 1/2]
Out[4]=

MatrixFieldOfValues works for SparseArray objects:

In[5]:=
ResourceFunction["MatrixFieldOfValues"][
 SparseArray[{Band[{2, 1}] -> 3 - 2 I, Band[{1, 2}] -> -1}, {5, 5}], 3.3]
Out[5]=

MatrixFieldOfValues threads elementwise over lists in the last argument:

In[6]:=
ResourceFunction[
 "MatrixFieldOfValues"][{{0, 1, 0, 0}, {0, 0, -2, 0}, {0, 0, 0, 3}, {-4, 0, 0, 0}}, {0., 0.5, 2.}]
Out[6]=

Applications (2) 

Visualize the field of values for a large sparse matrix:

In[7]:=
mat = ExampleData[{"Matrix", "DWA512"}];
ParametricPlot[
 ReIm[ResourceFunction["MatrixFieldOfValues"][mat, t]], {t, 0, 2 \[Pi]}, {Axes -> None, Frame -> True, PlotRange -> All}]
Out[7]=

Brillhart's cubic:

In[8]:=
ParametricPlot[ReIm[ResourceFunction["MatrixFieldOfValues"][\!\(\*
TagBox[
RowBox[{"(", "", GridBox[{
{"0", "2", "2"},
{"1", "0", "2"},
{"2", "1", "0"}
},
GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.7]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}], "", ")"}],
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\), t]], {t, 0, 2 \[Pi]}, Epilog -> {AbsolutePointSize[5], Point[ReIm[Eigenvalues[N@\!\(\*
TagBox[
RowBox[{"(", "", GridBox[{
{"0", "2", "2"},
{"1", "0", "2"},
{"2", "1", "0"}
},
GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}},
GridBoxSpacings->{"Columns" -> {
Offset[
                0.27999999999999997`], {
Offset[0.7]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}], "", ")"}],
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\)]]]}]
Out[8]=

Properties and Relations (3) 

The field of values for a 2×2 matrix is bounded by an ellipse:

In[9]:=
ParametricPlot[ReIm[ResourceFunction["MatrixFieldOfValues"][( {
     {3 + 4 I, I},
     {-3, 0}
    } ), t]], {t, 0, 2 \[Pi]}, {Axes -> None, Frame -> True, PlotRange -> All}]
Out[9]=

The field of values for a Hermitian matrix is a line segment:

In[10]:=
ParametricPlot[
 ReIm[ResourceFunction["MatrixFieldOfValues"][HilbertMatrix[3], t]], {t, 0, 2 \[Pi]}, {Axes -> None, Frame -> True, PlotRange -> {Automatic, {
Rational[-1, 2], 
Rational[1, 2]}}}]
Out[10]=

The field of values for a diagonal matrix is the convex hull of its eigenvalues:

In[11]:=
ParametricPlot[
 ReIm[ResourceFunction["MatrixFieldOfValues"][
   DiagonalMatrix[{2, I, 0, -1/2, -I, -1}], t]], {t, 0, 2 \[Pi]}, {Axes -> None, Frame -> True}]
Out[11]=

Version History

  • 1.0.0 – 25 January 2021

Source Metadata

Related Resources

Author Notes

Currently, this function is restricted to inexact numeric values. Support for exact values is planned for a future update.

License Information