Dear all,
I am currently trying to do solid mechanics (finite deformation) in SymPy. There are a lot of matrices that are positive definite, but I do not know whether there is a way to define this property in SymPy. Any help would be deeply appreciated!
Take this code snippet for example:
```
from sympy import symbols, init_printing, sqrt, simplify, Matrix
init_printing()
# Define a positive-definite real symmetric matrix
b11, b22, b33, b12, b13, b23 = symbols('b11, b22, b33, b12, b13, b23')
b = Matrix([[b11, b12, b13], [b12, b22, b23], [b13, b23, b33]])
J = sqrt(b.det())
lambda1sq, lambda2sq, lambda3sq = b.eigenvals()
lambda1, lambda2, lambda3 = sqrt(lambda1sq), sqrt(lambda2sq), sqrt(lambda3sq)
simplify(lambda1 * lambda2 * lambda3 - J)
```
1) Supposedly, the result of the simplify() should be zero. However it is not, because we are not sure whether the eigenvalues of the matrix b are positive! They are because the matrix should be positive definite, but I do not know how to define that.
2) Also, I know that I could've used real=True in where I defined the symbols of b11, b22, b33.... But I didn't do that. The reason is, if I use real=True, then I cannot get the eigenvalues any more - it will say
TypeError: cannot determine truth value of-b11*b22*b33 + b11*b23**2 + b12**2*b33 - 2*b12*b13*b23 + b13**2*b22 + 2*(-b11 - b22 - b33)**3/27 - (-b11 - b22 - b33)*(b11*b22 + b11*b33 - b12**2 - b13**2 + b22*b33 - b23**2)/3 < 0
Any way to tighten that up as well?
Thanks,
Shawn