Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-13 Thread Yuxiang Wang
Aaron, Thanks for your response! And sorry for the late reply. You mentioned: sqrt(det(M)) != sqrt(eigen1) * sqrt(eigen2) * sqrt(eigen3) is True if M is positive definite, so that det(M) is positive, eigen1-3 are positive. But I did use global_assumptions.add(Q.positive(J2)) global_assumption

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-04 Thread Aaron Meurer
On Wed, Feb 4, 2015 at 1:14 AM, Chris Smith wrote: > A brief description is - the sqrt(matrix determinant) is not equal to the >> product of the eigenvalues of matrix**(1/2). >> >> Could you please help a little bit in there...? Would what I am doing >> even be mathematically correct? >> > > >>>

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-04 Thread Yuxiang Wang
Aaron, Thanks for your response! I did find a detour by using juse lambda (not taking sqrt). Appreciate your help! Shawn On Tuesday, February 3, 2015 at 7:26:35 PM UTC-5, Aaron Meurer wrote: > > You've discovered that SymPy is really bad at dealing with algebraic > expressions. I would recomm

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-04 Thread Yuxiang Wang
Chris, Thank you for looking into this! I really appreciate it. And you are right that det(M) == Mul(*M.eigenvals()) However, if M is positive definite, then sqrt(det(M)) should also equal to sqrt(lambda1)*sqrt(lambda2)*sqrt(lambda3), where lambda1 - 3 are the eigenvalues of the matrix. (Becau

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-03 Thread Chris Smith
> > A brief description is - the sqrt(matrix determinant) is not equal to the > product of the eigenvalues of matrix**(1/2). > > Could you please help a little bit in there...? Would what I am doing even > be mathematically correct? > >>> var('a:d') (a, b, c, d) >>> m=Matrix(2,2,[a,b,c,d]) >>>

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-03 Thread Aaron Meurer
You've discovered that SymPy is really bad at dealing with algebraic expressions. I would recommend just sticking to what you did the first time, instead of dealing with sqrt(lambda), just use lambda. By the way, I don't think simplify() uses the new assumptions. You have to literally use refine(

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-02 Thread Yuxiang Wang
Hi Aaron, Thank you for your response! 1) You are right that it is a bug. If I do this: from sympy import symbols, sqrt, simplify, Matrix, Q from sympy.assumptions.assume import global_assumptions b11, b22, b33, b12, b13, b23 = symbols('b11, b22, b33, b12, b13, b23', real=True) b = Matrix([[b1

Re: [sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-02 Thread Aaron Meurer
On Mon, Feb 2, 2015 at 1:14 PM, Yuxiang Wang wrote: > 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 >

[sympy] Positive-definiteness of a Matrix instance in sympy

2015-02-02 Thread Yuxiang Wang
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: ``