08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

sage: m.is_one()<br />

False<br />

is_positive_definite()<br />

Determines if a real or symmetric matrix is positive definite.<br />

A square matrix A is postive definite if it is symmetric with real entries or Hermitan with complex entries,<br />

<strong>and</strong> for every non-zero vector ⃗x<br />

⃗x ∗ A⃗x > 0<br />

Here ⃗x ∗ is the conjugate-transpose, which can be simplified to just the transpose in the real case.<br />

ALGORITHM:<br />

A matrix is positive definite if <strong>and</strong> only if the diagonal entries from the indefinite factorization are all positive<br />

(see indefinite_factorization()). So this algorithm is <strong>of</strong> order n^3/3 <strong>and</strong> may be applied<br />

to matrices with elements <strong>of</strong> any ring that has a fraction field contained within the reals or complexes.<br />

INPUT:<br />

Any square matrix.<br />

OUTPUT:<br />

This routine will return True if the matrix is square, symmetric or Hermitian, <strong>and</strong> meets the condition<br />

above for the quadratic form.<br />

The base ring for the elements <strong>of</strong> the matrix needs to have a fraction field implemented <strong>and</strong> the computations<br />

that result from the indefinite factorization must be convertable to real numbers that are comparable<br />

to zero.<br />

EXAMPLES:<br />

A real symmetric matrix that is positive definite, as evidenced by the positive entries for the diagonal<br />

matrix <strong>of</strong> the indefinite factorization <strong>and</strong> the postive determinants <strong>of</strong> the leading principal submatrices.<br />

sage: A = matrix(QQ, [[ 4, -2, 4, 2],<br />

... [-2, 10, -2, -7],<br />

... [ 4, -2, 8, 4],<br />

... [ 2, -7, 4, 7]])<br />

sage: A.is_positive_definite()<br />

True<br />

sage: _, d = A.indefinite_factorization(algorithm=’symmetric’)<br />

sage: d<br />

(4, 9, 4, 1)<br />

sage: [A[:i,:i].determinant() for i in range(1,A.nrows()+1)]<br />

[4, 36, 144, 144]<br />

A real symmetric matrix which is not positive definite, along with a vector that makes the quadratic form<br />

negative.<br />

sage: A = matrix(QQ, [[ 3, -6, 9, 6, -9],<br />

... [-6, 11, -16, -11, 17],<br />

... [ 9, -16, 28, 16, -40],<br />

... [ 6, -11, 16, 9, -19],<br />

... [-9, 17, -40, -19, 68]])<br />

sage: A.is_positive_definite()<br />

False<br />

sage: _, d = A.indefinite_factorization(algorithm=’symmetric’)<br />

sage: d<br />

(3, -1, 5, -2, -1)<br />

189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!