Ask Your Question

Revision history [back]

You could start from a random positive diagonal and conjugate

sage: A = diagonal_matrix(RDF, [RDF.random_element(1,5) for _ in range(5)])
sage: B = random_matrix(RDF, 5)
sage: C = B.transpose() * A * B
sage: C.is_positive_definite()
True

(The above is not a serious algorithm for integer matrices since all eigenvalues would be integral...)