Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a matrix which I know to be positive definite. The entries of the matrix might be complicated but they are all real. To find an expression for the square root of this matrix (i.e., SS = A) I'm trying :

Ftemp = {{F11, F12, F13, 0, 0}, 
         {F12, F22, 0, 0, 0}, 
         {F13, 0, F33, 0,F35}, 
         {0, 0, 0, F44, F45}, 
         {0, 0, F35, F45, F55}}

All the elements in the matrix real. We know there exists a positive square root for this matrix , however , it will be horrible analytically. What I would like to know however, is which entries in the resulting solution will be different from zero (and thus which entries will be zero).

share|improve this question
1  
As David pointed out, you will get a huge output. I looked at parts of the output, and it appears that the only terms which are not functions of the matrix entries look like Root[some cubic polynomial,integer between 1 and 3]. You can simplify that part further using Solve instead of Root. –  Michael Wijaya Feb 8 '12 at 4:04
    
Wait... your matrix is unsymmetric?! Your results are certainly going to be complicated. Where did this matrix come from? –  J. M. Feb 8 '12 at 15:26
add comment

migrated from stackoverflow.com Feb 8 '12 at 15:04

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

Are all of the Fs real? If so, try this:

Assuming[{F11, F12, F13, F21, F22, F24, F33, F35, F44, F45, F53, F54, 
   F55} \[Element] Reals, MatrixPower[Ftemp, 1/2]]

You'll get an answer, but it'll be ugly...

You can use Position to test for zero elements like this (in this case I'm applying it to your original matrix to show that it works):

Position[Ftemp,x_/;PossibleZeroQ[x]]
{{1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 2}, {3, 4}, {4, 1}, {4, 
  2}, {4, 3}, {5, 1}, {5, 2}}

So for the matrix you're interested in:

FtempInv = Assuming[{F11, F12, F13, F21, F22, F24, F33, F35, F44, F45, F53, 
     F54, F55} \[Element] Reals, MatrixPower[Ftemp, 1/2]];
Position[FtempInv,x_/;PossibleZeroQ[x]]

Unfortunately, when I do that MMA spends a great deal of time thinking and I have yet to see an answer. There may be better test to use here than PossibleZeroQ; if so, I'm sure someone else will suggest one.

It turns out that PossibleZeroQ is Listable, so you can you just do

PossibleZeroQ[FtempInv]

But that doesn't solve the speed problem...

I let PossibleZeroQ[FtempInv] run for a while. Here's what I got:

{{False, False, False, False, False}, {False, False, False, False, False}, {False, False, False, False, False}, {False, False, False, False, False}, {False, False, False, False, False}}

share|improve this answer
1  
Actually, I get the same answer regardless of whether or not I assume the elements are real. I wonder if you're running into memory problems or if you're using an older version of Mathematica? I'm using 8.0.4. –  David Skulsky Feb 8 '12 at 1:19
    
Hi guys, this was my post originally but I lost my account name form yesterday. The matrix comes from the solution to a algebraic ricatti equation. Now, I know F is positive semi definite since it comes from some transition and diffusion matrices in a statespace representation. Obviously this is going to be an ugly output, but thinking about it , I only need to know which elements of the solution are different from zero. –  PaulW Feb 8 '12 at 21:04
    
Is there a mapping rule I can use to test this? –  PaulW Feb 8 '12 at 21:15
    
I'm afraid I don't understand your question. Test what? –  David Skulsky Feb 9 '12 at 1:49
1  
If the entries of the original matrix are all exact numbers, I'd suggest processing the output of MatrixPower[] with RootReduce[] before submitting to Position[]. –  J. M. Feb 9 '12 at 12:30
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.