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: [A[:i,:i].determinant() for i in range(1,A.nrows()+1)]<br />

[3, -3, -15, 30, -30]<br />

sage: u = vector(QQ, [2, 2, 0, 1, 0])<br />

sage: u.row()*A*u<br />

(-3)<br />

A real symmetric matrix with a singular leading principal submatrix, that is therefore not positive definite.<br />

The vector u makes the quadratic form zero.<br />

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

... [15, 12, 9, 6],<br />

... [12, 9, 7, 3],<br />

... [-2, 6, 3, 8]])<br />

sage: A.is_positive_definite()<br />

False<br />

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

[21, 27, 0, -75]<br />

sage: u = vector(QQ, [1,1,-3,0])<br />

sage: u.row()*A*u<br />

(0)<br />

An Hermitian matrix that is positive definite.<br />

sage: C. = NumberField(x^2 + 1)<br />

sage: A = matrix(C, [[ 23, 17*I + 3, 24*I + 25, 21*I],<br />

... [ -17*I + 3, 38, -69*I + 89, 7*I + 15],<br />

... [-24*I + 25, 69*I + 89, 976, 24*I + 6],<br />

... [ -21*I, -7*I + 15, -24*I + 6, 28]])<br />

sage: A.is_positive_definite()<br />

True<br />

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

sage: d<br />

(23, 576/23, 89885/144, 142130/17977)<br />

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

[23, 576, 359540, 2842600]<br />

An Hermitian matrix that is not positive definite. The vector u makes the quadratic form negative.<br />

sage: C. = QuadraticField(-1)<br />

sage: B = matrix(C, [[ 2, 4 - 2*I, 2 + 2*I],<br />

... [4 + 2*I, 8, 10*I],<br />

... [2 - 2*I, -10*I, -3]])<br />

sage: B.is_positive_definite()<br />

False<br />

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

sage: d<br />

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

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

[2, -4, -12]<br />

sage: u = vector(C, [-5 + 10*I, 4 - 3*I, 0])<br />

sage: u.row().conjugate()*B*u<br />

(-50)<br />

A positive definite matrix over an algebraically closed field.<br />

sage: A = matrix(QQbar, [[ 2, 4 + 2*I, 6 - 4*I],<br />

... [ -2*I + 4, 11, 10 - 12*I],<br />

... [ 4*I + 6, 10 + 12*I, 37]])<br />

sage: A.is_positive_definite()<br />

190 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!