def chck_posdef1(A):
    B=transpose(A)
    C=B*A
    s="pos"
    i=0
    while i<len(C.rows()):

        ci=C[:i+1,:i+1]
        if det(ci)>0:
            i=i+1
        else:
            s="not pos"
            break    
    print s
    
                 
A1=matrix([[1,2],[0,3]])
chck_posdef1(A1)
out:pos

A2=matrix([[1,1],[1,2],[2,1]])
chck_posdef1(A2)
out:pos

A3=matrix([[1,1,2],[1,2,1]])
chck_posdef1(A3)
out:not pos

Strang-317-17-U (last edited 2010-12-17 04:33:38 by rupampy)