How to get the symbolic expression of eigenvalues and eigenvectors of this 3x3 real symmetric matrix

146 views
Skip to first unread message

Jon

unread,
Jan 21, 2015, 1:56:29 PM1/21/15
to sage-s...@googlegroups.com
Hi all, I used the following code in notebook but it fails to give results. Any suggestions?

var('a11,a12,a13,a14,a15,a16,a22,a23,a24,a25,a26,a33,a34,a35,a36,a44,a45,a46,a55,a56,a66,p,q,r', domain='real')
g11=a11*p*p+a66*q*q+a55*r*r+2.0*a16*p*q+2.0*a15*p*r+2.0*a56*q*r;
g22=a66*p*p+a22*q*q+a44*r*r+2.0*a26*p*q+2.0*a46*p*r+2.0*a24*q*r;
g33=a55*p*p+a44*q*q+a33*r*r+2.0*a45*p*q+2.0*a35*p*r+2.0*a34*q*r;
g12=a16*p*p+a26*q*q+a45*r*r+(a12+a66)*p*q+(a14+a56)*p*r+(a46+a25)*q*r;                       
g13=a15*p*p+a46*q*q+a35*r*r+(a14+a56)*p*q+(a13+a55)*p*r+(a36+a45)*q*r;                       
g23=a56*p*p+a24*q*q+a34*r*r+(a46+a25)*p*q+(a36+a45)*p*r+(a23+a44)*q*r;

g0=matrix(3,3,[g11,g12,g13,g12,g22,g23,g13,g12,g33]).eigenvectors_right()

It shows error "TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the memory limits before executing the program again." I have 9GB ram, and it fails before exhausting the ram.

The reason I insist on calculating symbolic expressions first instead of numerical solution is that (1) aij and p,q,r are varying, (2) I want the eigenvalue associated with the same eigenvector or eigensystem for different aij, p,q,r.  If I use numerical solution I lose the track of the eigensystem. Thanks very much.

Nils Bruin

unread,
Jan 21, 2015, 3:47:12 PM1/21/15
to sage-s...@googlegroups.com
On Wednesday, January 21, 2015 at 10:56:29 AM UTC-8, Jon wrote:
Hi all, I used the following code in notebook but it fails to give results. Any suggestions?

var('a11,a12,a13,a14,a15,a16,a22,a23,a24,a25,a26,a33,a34,a35,a36,a44,a45,a46,a55,a56,a66,p,q,r', domain='real')
g11=a11*p*p+a66*q*q+a55*r*r+2.0*a16*p*q+2.0*a15*p*r+2.0*a56*q*r;
g22=a66*p*p+a22*q*q+a44*r*r+2.0*a26*p*q+2.0*a46*p*r+2.0*a24*q*r;
g33=a55*p*p+a44*q*q+a33*r*r+2.0*a45*p*q+2.0*a35*p*r+2.0*a34*q*r;
g12=a16*p*p+a26*q*q+a45*r*r+(a12+a66)*p*q+(a14+a56)*p*r+(a46+a25)*q*r;                       
g13=a15*p*p+a46*q*q+a35*r*r+(a14+a56)*p*q+(a13+a55)*p*r+(a36+a45)*q*r;                       
g23=a56*p*p+a24*q*q+a34*r*r+(a46+a25)*p*q+(a36+a45)*p*r+(a23+a44)*q*r;

g0=matrix(3,3,[g11,g12,g13,g12,g22,g23,g13,g12,g33]).eigenvectors_right()

It shows error "TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the memory limits before executing the program again." I have 9GB ram, and it fails before exhausting the ram.

Currently, maxima_calculus (the maxima instance that is used for some symbolic calculations, apparently among which is the symbolic computation of eigenvectors) has a memory limit of 1GB. You can lift that restriction with the following command:

sage: maxima_calculus(1) #trigger the initialization of maxima
1
sage: from sage.libs.ecl import ecl_eval
sage: ecl_eval("(ext:set-limit 'ext:heap-size 0)")
<ECL: 0>

That said, I suspect doing so will just postpone failure, since the answer you're asking likely doesn't fit in any computer. It tends to be true in general that things that maxima is useful for tend to fit in a modest amount of memory. So failing be default on a relatively low memory limit gives early failure in cases that would likely fail anyway.

To get an idea of how big your answer likely is, you can estimate the degree of the coefficients in the characteristic polynomial (3 times the degree of the terms in the matrix) and count how many monomials in 24 variables of that degree exist. That gives you a ballpark number of term you're likely asking maxima to work with.

Jon

unread,
Jan 21, 2015, 4:41:58 PM1/21/15
to sage-s...@googlegroups.com
Thanks Nils. You are right. It just takes a bit longer to fail. I guess the numerical solution is the only way to proceed. just need a way to track the eigensystem numerically.
Reply all
Reply to author
Forward
0 new messages