Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Find out if matrix is positive semidefinite

What can I do to find out if a real or complex (symmetric/hermitian) matrix is positive definite (or better: positive semidefinite).

More specifically, the following code doesn't work:

reset()
f(t) = exp(I*t)
ts = [random() for k in range(3)]
var('k, l')
mm = matrix(CC,len(ts))
for k in range(1,len(ts)):
    for l in range(1,len(ts)):
        mm[k,l] = f(ts[k] - ts[l])
mm.is_positive_definite()

It gives the error:

TypeError: entries of the matrix must be in an exact ring, not Complex
Field with 53 bits of precision
click to hide/show revision 2
retagged

Find out if matrix is positive semidefinite

What can I do to find out if a real or complex (symmetric/hermitian) matrix is positive definite (or better: positive semidefinite).

More specifically, the following code doesn't work:

reset()
f(t) = exp(I*t)
ts = [random() for k in range(3)]
var('k, l')
mm = matrix(CC,len(ts))
for k in range(1,len(ts)):
    for l in range(1,len(ts)):
        mm[k,l] = f(ts[k] - ts[l])
mm.is_positive_definite()

It gives the error:

TypeError: entries of the matrix must be in an exact ring, not Complex
Field with 53 bits of precision