Function: semidef - test for positive and negative definite and semidefinite matrices and Matrices

Calling sequence:

semidef(A,t);

Parameters:

A - a square matrix or Matrix

t - one of the four names positive_def , negative_def , positive_semidef and negative_semidef .

Description:

Examples:

A 3 x 3 matrix that definite and IsDefinite incorrectly identify as positive semidefinite:

> A:= matrix([[2,0,3],[0,0,0],[3,0,1]]);
"definite answers", linalg[definite](A,positive_semidef);
"IsDefinite answers",
LinearAlgebra:-IsDefinite(Matrix(A),
query=positive_semidef);
"semidef answers",
semidef(A,positive_semidef);
"Eigenvalues are",evalf(Eigenvals(A));

A := matrix([[2, 0, 3], [0, 0, 0], [3, 0, 1]])

Another 3 x 3 example which IsDefinite incorrectly identifies as positive semidefinite.

> A:= Matrix([[2,0,3],[0,1,0],[3,0,1]]);
"definite answers", linalg[definite](convert(A,matrix),positive_semidef);"IsDefinite answers",
LinearAlgebra[IsDefinite](A,query=positive_semidef);
"semidef answers",
semidef(A,positive_semidef);
"Eigenvalues are",evalf(LinearAlgebra:-Eigenvalues(A));

A := _rtable[7447024]

A complex hermitian matrix: definite incorrectly identifies it as not positive definite.

> A:= matrix([[2,I],[-I,2]]);
"definite answers",
linalg[definite](A,positive_def);
"semidef answers",
semidef(A,positive_def);
"Eigenvalues are",linalg[eigenvals](A);

A := matrix([[2, I], [-I, 2]])

A matrix with symbolic entries: this is hermitian if the parameter p is real.

> A:= matrix([[2,I*p],[-I*p,2]]);
"IsDefinite returns an error";
LinearAlgebra:-IsDefinite(Matrix(A),
query=positive_def);
"definite answers",linalg[definite](A,positive_def);
"semidef answers",
semidef(A,positive_def);
"Eigenvalues are",linalg[eigenvals](A);

A := matrix([[2, I*p], [-I*p, 2]])

Error, (in LinearAlgebra:-LA_Main:-IsDefinite) cannot evaluate boolean: p^2 < 4

Another matrix with entries depending on a parameter. The result of semidef is rather complicated, but solve can be used. In this case solve does not work on the output of definite , while the result of IsDefinite is incorrect.

> A:= matrix([[4+p,0,p,1],[0,3,p,2],[p,p,4,-p],[1,2,-p,2]]);

A := matrix([[4+p, 0, p, 1], [0, 3, p, 2], [p, p, 4...

> linalg[definite](A,positive_semidef); solve(%,p);

-4-p <= 0 and -48+7*p^2-12*p+p^3 <= 0 and -20+47*p^...
-4-p <= 0 and -48+7*p^2-12*p+p^3 <= 0 and -20+47*p^...

Error, (in RealRange_fromineq) cannot handle intervals, use solve over name sets

> solve({-4-p <= 0, -48+7*p^2-12*p+p^3 <= 0, -20+47*p^2-8*p+9*p^3 <= 0, -12+p^2 <= 0,
-8+9*p^2 <= 0, -8+p^2 <= 0},p);

{RootOf(-20+47*_Z^2-8*_Z+9*_Z^3,-.6040871636) <= p,...
{RootOf(-20+47*_Z^2-8*_Z+9*_Z^3,-.6040871636) <= p,...

> LinearAlgebra[IsDefinite](Matrix(A),query=positive_semidef); solve(%);

-4-p <= 0 and -12+p^2 <= 0 and -8+p^2 <= 0

RealRange(-2*sqrt(2),2*sqrt(2))

> semidef(A,positive_semidef);solve(%);

{0 <= 9*p+57-3*p^2, 0 <= -9*p^3+20-47*p^2+8*p, 0 <=...
{0 <= 9*p+57-3*p^2, 0 <= -9*p^3+20-47*p^2+8*p, 0 <=...

{RootOf(-20+47*_Z^2-8*_Z+9*_Z^3,-.6040871636) <= p,...
{RootOf(-20+47*_Z^2-8*_Z+9*_Z^3,-.6040871636) <= p,...

See also: linalg , linalg[definite] , LinearAlgebra , LinearAlgebra[IsDefinite] , matrix , Matrix

Maple Advisor Database R. Israel, 2000