MapleEnthusiast

60 Reputation

2 Badges

4 years, 344 days

MaplePrimes Activity


These are replies submitted by MapleEnthusiast

@Carl Love 

Ok, I have radically reduced the complexity of the problem from a 27x27 to a 12x12 matrix (see Problem_2.mw). As before, it is a sparse symbolic matrix with 2/3 of the matrix filled with zeroes. In your experience, which method do you think would prove to be more efficient -- the "solve({},{})" or the LinearAlgebra[MatrixInverse](, method=pseudo) (i.e., Moore-Penrose)? Thank you very much.

Dear @Carl Love 

Sorry for the follow-up -- unfortunately, the problem is too important to simply stop thinking about it. I've written up the problem in a slightly different way and have been trying to solve it using Maple's solve({},{}) command. Do you mind taking a brief look into the attached Maple file and let me know whether your verdict is still the same? Thank you very much. 

Problem.mw

 

 

@Carl Love 

I apologize for this omission of mine -- you're right, the rank of the matrix is 9. I assume, calculating the Moore-Penrose pseudo-inverse of this matrix using LinearAlgebra[MatrixInverse](, method=pseudo) will not become any more computationally efficient than what you described above for the regular inverse, right? Thank you for you patience with me (as you might have noticed, I'm not a mathematician...)

@Carl Love 

ok, you have convinced me that inverting the entire matrix is pointless, yet I'm wondering whether there is any (more efficient) way of retrieveing individual entries of this matrix (say, one row). Searching for possible solutions, I came across this and this forum entry (implemented in Mathematica) -- is there a similar command in Maple? Alternatively, some forum entries suggest that "If you're multiplying the inverse with a vector or a matrix, as opposed to the needing the bare inverse, then you don't need the inverse. Use LinearSolve[] " Would it be more efficient to use solve({},{}) instead? Thank you.   

@Carl Love 

Sorry for misspelling. May I still follow-up to better understand what kind of special patter would help -- perhaps I can rearrrange the matrix accordingly to that end and, in so doing, expedite the process. Many thanks.

@Carl Love 

Thanks. Perhaps I should clarify then what you mean by the "very simple" (or "very spatial") pattern? All entries follow a very clear pattern in that, in each column, all gamma's have the same subscripts and all pi's subscripts consecutively change their fourth and then second subscript. But does it change anything with the speed of the algorithm? 

@Carl Love 

Thank you for your extensive response. To give you a bit of a background information: I have sucessfully (within 2 hours) inverted in Maple a similar 8x8 matrix, which -- despite the problem's complexity -- is largely due to the fact that 2/3 of the matrix is filled with zeroes. Clearly, inverting a 27x27 matrix is significantly more tedeous than a 8x8 matrix, but I was wondering whether the fact that, once again, 2/3 of the matrix is composed of zeroes, may make it solvable in Maple. (I assume solving the system of 27 linear equations using solve({},{}) will not make it any more efficient, right?) I would really appreciate any advice in this matter. Thank you.

@Carl Love @Joe Riel

Please find below my data (a 27x27 matrix). Using Joe's code, I successfully imported these data as an array A.

May I ask a quick follow-up question? (I know, this is a different topic, but since you have already dealth with my data, perhaps you could answer it as well.) I am trying to invert the above-mentioned 27x27 matrix using the following code:

M := convert(A, Matrix)

B := LinearAlgebra:-IdentityMatrix(27, 27)

with(LinearAlgebra):

P := MatrixInverse(B - M)

The last operation of the matrix inversion has been running for 24 hours (on a 64GB RAM machine) and, unfortunately, is still not done. Is there a more efficient way to invert large matrices in Maple? 

Thank you so much for your amazing help.

-----DATA----

 pi[1,1,1,1]*gamma[1,1,1] ,0,0, pi[1,1,1,1]*gamma[1,2,1] ,0,0, pi[1,1,1,1]*gamma[1,3,1] ,0,0, pi[2,1,1,1]*gamma[2,1,1] ,0,0, pi[2,1,1,1]*gamma[2,2,1] ,0,0, pi[2,1,1,1]*gamma[2,3,1] ,0,0, pi[3,1,1,1]*gamma[3,1,1] ,0,0, pi[3,1,1,1]*gamma[3,2,1] ,0,0, pi[3,1,1,1]*gamma[3,3,1] ,0,0
 pi[1,1,1,2]*gamma[1,1,1] ,0,0, pi[1,1,1,2]*gamma[1,2,1] ,0,0, pi[1,1,1,2]*gamma[1,3,1] ,0,0, pi[2,1,1,2]*gamma[2,1,1] ,0,0, pi[2,1,1,2]*gamma[2,2,1] ,0,0, pi[2,1,1,2]*gamma[2,3,1] ,0,0, pi[3,1,1,2]*gamma[3,1,1] ,0,0, pi[3,1,1,2]*gamma[3,2,1] ,0,0, pi[3,1,1,2]*gamma[3,3,1] ,0,0
 pi[1,1,1,3]*gamma[1,1,1] ,0,0, pi[1,1,1,3]*gamma[1,2,1] ,0,0, pi[1,1,1,3]*gamma[1,3,1] ,0,0, pi[2,1,1,3]*gamma[2,1,1] ,0,0, pi[2,1,1,3]*gamma[2,2,1] ,0,0, pi[2,1,1,3]*gamma[2,3,1] ,0,0, pi[3,1,1,3]*gamma[3,1,1] ,0,0, pi[3,1,1,3]*gamma[3,2,1] ,0,0, pi[3,1,1,3]*gamma[3,3,1] ,0,0
0, pi[1,1,2,1]*gamma[1,1,2] ,0,0, pi[1,1,2,1]*gamma[1,2,2] ,0,0, pi[1,1,2,1]*gamma[1,3,2] ,0,0, pi[2,1,2,1]*gamma[2,1,2] ,0,0, pi[2,1,2,1]*gamma[2,2,2] ,0,0, pi[2,1,2,1]*gamma[2,3,2] ,0,0, pi[3,1,2,1]*gamma[3,1,2] ,0,0, pi[3,1,2,1]*gamma[3,2,2] ,0,0, pi[3,1,2,1]*gamma[3,3,2] ,0
0, pi[1,1,2,2]*gamma[1,1,2] ,0,0, pi[1,1,2,2]*gamma[1,2,2] ,0,0, pi[1,1,2,2]*gamma[1,3,2] ,0,0, pi[2,1,2,2]*gamma[2,1,2] ,0,0, pi[2,1,2,2]*gamma[2,2,2] ,0,0, pi[2,1,2,2]*gamma[2,3,2] ,0,0, pi[3,1,2,2]*gamma[3,1,2] ,0,0, pi[3,1,2,2]*gamma[3,2,2] ,0,0, pi[3,1,2,2]*gamma[3,3,2] ,0
0, pi[1,1,2,3]*gamma[1,1,2] ,0,0, pi[1,1,2,3]*gamma[1,2,2] ,0,0, pi[1,1,2,3]*gamma[1,3,2] ,0,0, pi[2,1,2,3]*gamma[2,1,2] ,0,0, pi[2,1,2,3]*gamma[2,2,2] ,0,0, pi[2,1,2,3]*gamma[2,3,2] ,0,0, pi[3,1,2,3]*gamma[3,1,2] ,0,0, pi[3,1,2,3]*gamma[3,2,2] ,0,0, pi[3,1,2,3]*gamma[3,3,2] ,0
0,0, pi[1,1,3,1]*gamma[1,1,3] ,0,0, pi[1,1,3,1]*gamma[1,2,3] ,0,0, pi[1,1,3,1]*gamma[1,3,3] ,0,0, pi[2,1,3,1]*gamma[2,1,3] ,0,0, pi[2,1,3,1]*gamma[2,2,3] ,0,0, pi[2,1,3,1]*gamma[2,3,3] ,0,0, pi[3,1,3,1]*gamma[3,1,3] ,0,0, pi[3,1,3,1]*gamma[3,2,3] ,0,0, pi[3,1,3,1]*gamma[3,3,3] 
0,0, pi[1,1,3,2]*gamma[1,1,3] ,0,0, pi[1,1,3,2]*gamma[1,2,3] ,0,0, pi[1,1,3,2]*gamma[1,3,3] ,0,0, pi[2,1,3,2]*gamma[2,1,3] ,0,0, pi[2,1,3,2]*gamma[2,2,3] ,0,0, pi[2,1,3,2]*gamma[2,3,3] ,0,0, pi[3,1,3,2]*gamma[3,1,3] ,0,0, pi[3,1,3,2]*gamma[3,2,3] ,0,0, pi[3,1,3,2]*gamma[3,3,3] 
0,0, pi[1,1,3,3]*gamma[1,1,3] ,0,0, pi[1,1,3,3]*gamma[1,2,3] ,0,0, pi[1,1,3,3]*gamma[1,3,3] ,0,0, pi[2,1,3,3]*gamma[2,1,3] ,0,0, pi[2,1,3,3]*gamma[2,2,3] ,0,0, pi[2,1,3,3]*gamma[2,3,3] ,0,0, pi[3,1,3,3]*gamma[3,1,3] ,0,0, pi[3,1,3,3]*gamma[3,2,3] ,0,0, pi[3,1,3,3]*gamma[3,3,3] 
 pi[1,2,1,1]*gamma[1,1,1] ,0,0, pi[1,2,1,1]*gamma[1,2,1] ,0,0, pi[1,2,1,1]*gamma[1,3,1] ,0,0, pi[2,2,1,1]*gamma[2,1,1] ,0,0, pi[2,2,1,1]*gamma[2,2,1] ,0,0, pi[2,2,1,1]*gamma[2,3,1] ,0,0, pi[3,2,1,1]*gamma[3,1,1] ,0,0, pi[3,2,1,1]*gamma[3,2,1] ,0,0, pi[3,2,1,1]*gamma[3,3,1] ,0,0
 pi[1,2,1,2]*gamma[1,1,1] ,0,0, pi[1,2,1,2]*gamma[1,2,1] ,0,0, pi[1,2,1,2]*gamma[1,3,1] ,0,0, pi[2,2,1,2]*gamma[2,1,1] ,0,0, pi[2,2,1,2]*gamma[2,2,1] ,0,0, pi[2,2,1,2]*gamma[2,3,1] ,0,0, pi[3,2,1,2]*gamma[3,1,1] ,0,0, pi[3,2,1,2]*gamma[3,2,1] ,0,0, pi[3,2,1,2]*gamma[3,3,1] ,0,0
 pi[1,2,1,3]*gamma[1,1,1] ,0,0, pi[1,2,1,3]*gamma[1,2,1] ,0,0, pi[1,2,1,3]*gamma[1,3,1] ,0,0, pi[2,2,1,3]*gamma[2,1,1] ,0,0, pi[2,2,1,3]*gamma[2,2,1] ,0,0, pi[2,2,1,3]*gamma[2,3,1] ,0,0, pi[3,2,1,3]*gamma[3,1,1] ,0,0, pi[3,2,1,3]*gamma[3,2,1] ,0,0, pi[3,2,1,3]*gamma[3,3,1] ,0,0
0, pi[1,2,2,1]*gamma[1,1,2] ,0,0, pi[1,2,2,1]*gamma[1,2,2] ,0,0, pi[1,2,2,1]*gamma[1,3,2] ,0,0, pi[2,2,2,1]*gamma[2,1,2] ,0,0, pi[2,2,2,1]*gamma[2,2,2] ,0,0, pi[2,2,2,1]*gamma[2,3,2] ,0,0, pi[3,2,2,1]*gamma[3,1,2] ,0,0, pi[3,2,2,1]*gamma[3,2,2] ,0,0, pi[3,2,2,1]*gamma[3,3,2] ,0
0, pi[1,2,2,2]*gamma[1,1,2] ,0,0, pi[1,2,2,2]*gamma[1,2,2] ,0,0, pi[1,2,2,2]*gamma[1,3,2] ,0,0, pi[2,2,2,2]*gamma[2,1,2] ,0,0, pi[2,2,2,2]*gamma[2,2,2] ,0,0, pi[2,2,2,2]*gamma[2,3,2] ,0,0, pi[3,2,2,2]*gamma[3,1,2] ,0,0, pi[3,2,2,2]*gamma[3,2,2] ,0,0, pi[3,2,2,2]*gamma[3,3,2] ,0
0, pi[1,2,2,3]*gamma[1,1,2] ,0,0, pi[1,2,2,3]*gamma[1,2,2] ,0,0, pi[1,2,2,3]*gamma[1,3,2] ,0,0, pi[2,2,2,3]*gamma[2,1,2] ,0,0, pi[2,2,2,3]*gamma[2,2,2] ,0,0, pi[2,2,2,3]*gamma[2,3,2] ,0,0, pi[3,2,2,3]*gamma[3,1,2] ,0,0, pi[3,2,2,3]*gamma[3,2,2] ,0,0, pi[3,2,2,3]*gamma[3,3,2] ,0
0,0, pi[1,2,3,1]*gamma[1,1,3] ,0,0, pi[1,2,3,1]*gamma[1,2,3] ,0,0, pi[1,2,3,1]*gamma[1,3,3] ,0,0, pi[2,2,3,1]*gamma[2,1,3] ,0,0, pi[2,2,3,1]*gamma[2,2,3] ,0,0, pi[2,2,3,1]*gamma[2,3,3] ,0,0, pi[3,2,3,1]*gamma[3,1,3] ,0,0, pi[3,2,3,1]*gamma[3,2,3] ,0,0, pi[3,2,3,1]*gamma[3,3,3] 
0,0, pi[1,2,3,2]*gamma[1,1,3] ,0,0, pi[1,2,3,2]*gamma[1,2,3] ,0,0, pi[1,2,3,2]*gamma[1,3,3] ,0,0, pi[2,2,3,2]*gamma[2,1,3] ,0,0, pi[2,2,3,2]*gamma[2,2,3] ,0,0, pi[2,2,3,2]*gamma[2,3,3] ,0,0, pi[3,2,3,2]*gamma[3,1,3] ,0,0, pi[3,2,3,2]*gamma[3,2,3] ,0,0, pi[3,2,3,2]*gamma[3,3,3] 
0,0, pi[1,2,3,3]*gamma[1,1,3] ,0,0, pi[1,2,3,3]*gamma[1,2,3] ,0,0, pi[1,2,3,3]*gamma[1,3,3] ,0,0, pi[2,2,3,3]*gamma[2,1,3] ,0,0, pi[2,2,3,3]*gamma[2,2,3] ,0,0, pi[2,2,3,3]*gamma[2,3,3] ,0,0, pi[3,2,3,3]*gamma[3,1,3] ,0,0, pi[3,2,3,3]*gamma[3,2,3] ,0,0, pi[3,2,3,3]*gamma[3,3,3] 
 pi[1,3,1,1]*gamma[1,1,1] ,0,0, pi[1,3,1,1]*gamma[1,2,1] ,0,0, pi[1,3,1,1]*gamma[1,3,1] ,0,0, pi[2,3,1,1]*gamma[2,1,1] ,0,0, pi[2,3,1,1]*gamma[2,2,1] ,0,0, pi[2,3,1,1]*gamma[2,3,1] ,0,0, pi[3,3,1,1]*gamma[3,1,1] ,0,0, pi[3,3,1,1]*gamma[3,2,1] ,0,0, pi[3,3,1,1]*gamma[3,3,1] ,0,0
 pi[1,3,1,2]*gamma[1,1,1] ,0,0, pi[1,3,1,2]*gamma[1,2,1] ,0,0, pi[1,3,1,2]*gamma[1,3,1] ,0,0, pi[2,3,1,2]*gamma[2,1,1] ,0,0, pi[2,3,1,2]*gamma[2,2,1] ,0,0, pi[2,3,1,2]*gamma[2,3,1] ,0,0, pi[3,3,1,2]*gamma[3,1,1] ,0,0, pi[3,3,1,2]*gamma[3,2,1] ,0,0, pi[3,3,1,2]*gamma[3,3,1] ,0,0
 pi[1,3,1,3]*gamma[1,1,1] ,0,0, pi[1,3,1,3]*gamma[1,2,1] ,0,0, pi[1,3,1,3]*gamma[1,3,1] ,0,0, pi[2,3,1,3]*gamma[2,1,1] ,0,0, pi[2,3,1,3]*gamma[2,2,1] ,0,0, pi[2,3,1,3]*gamma[2,3,1] ,0,0, pi[3,3,1,3]*gamma[3,1,1] ,0,0, pi[3,3,1,3]*gamma[3,2,1] ,0,0, pi[3,3,1,3]*gamma[3,3,1] ,0,0
0, pi[1,3,2,1]*gamma[1,1,2] ,0,0, pi[1,3,2,1]*gamma[1,2,2] ,0,0, pi[1,3,2,1]*gamma[1,3,2] ,0,0, pi[2,3,2,1]*gamma[2,1,2] ,0,0, pi[2,3,2,1]*gamma[2,2,2] ,0,0, pi[2,3,2,1]*gamma[2,3,2] ,0,0, pi[3,3,2,1]*gamma[3,1,2] ,0,0, pi[3,3,2,1]*gamma[3,2,2] ,0,0, pi[3,3,2,1]*gamma[3,3,2] ,0
0, pi[1,3,2,2]*gamma[1,1,2] ,0,0, pi[1,3,2,2]*gamma[1,2,2] ,0,0, pi[1,3,2,2]*gamma[1,3,2] ,0,0, pi[2,3,2,2]*gamma[2,1,2] ,0,0, pi[2,3,2,2]*gamma[2,2,2] ,0,0, pi[2,3,2,2]*gamma[2,3,2] ,0,0, pi[3,3,2,2]*gamma[3,1,2] ,0,0, pi[3,3,2,2]*gamma[3,2,2] ,0,0, pi[3,3,2,2]*gamma[3,3,2] ,0
0, pi[1,3,2,3]*gamma[1,1,2] ,0,0, pi[1,3,2,3]*gamma[1,2,2] ,0,0, pi[1,3,2,3]*gamma[1,3,2] ,0,0, pi[2,3,2,3]*gamma[2,1,2] ,0,0, pi[2,3,2,3]*gamma[2,2,2] ,0,0, pi[2,3,2,3]*gamma[2,3,2] ,0,0, pi[3,3,2,3]*gamma[3,1,2] ,0,0, pi[3,3,2,3]*gamma[3,2,2] ,0,0, pi[3,3,2,3]*gamma[3,3,2] ,0
0,0, pi[1,3,3,1]*gamma[1,1,3] ,0,0, pi[1,3,3,1]*gamma[1,2,3] ,0,0, pi[1,3,3,1]*gamma[1,3,3] ,0,0, pi[2,3,3,1]*gamma[2,1,3] ,0,0, pi[2,3,3,1]*gamma[2,2,3] ,0,0, pi[2,3,3,1]*gamma[2,3,3] ,0,0, pi[3,3,3,1]*gamma[3,1,3] ,0,0, pi[3,3,3,1]*gamma[3,2,3] ,0,0, pi[3,3,3,1]*gamma[3,3,3] 
0,0, pi[1,3,3,2]*gamma[1,1,3] ,0,0, pi[1,3,3,2]*gamma[1,2,3] ,0,0, pi[1,3,3,2]*gamma[1,3,3] ,0,0, pi[2,3,3,2]*gamma[2,1,3] ,0,0, pi[2,3,3,2]*gamma[2,2,3] ,0,0, pi[2,3,3,2]*gamma[2,3,3] ,0,0, pi[3,3,3,2]*gamma[3,1,3] ,0,0, pi[3,3,3,2]*gamma[3,2,3] ,0,0, pi[3,3,3,2]*gamma[3,3,3] 
0,0, pi[1,3,3,3]*gamma[1,1,3] ,0,0, pi[1,3,3,3]*gamma[1,2,3] ,0,0, pi[1,3,3,3]*gamma[1,3,3] ,0,0, pi[2,3,3,3]*gamma[2,1,3] ,0,0, pi[2,3,3,3]*gamma[2,2,3] ,0,0, pi[2,3,3,3]*gamma[2,3,3] ,0,0, pi[3,3,3,3]*gamma[3,1,3] ,0,0, pi[3,3,3,3]*gamma[3,2,3] ,0,0, pi[3,3,3,3]*gamma[3,3,3] 

@Joe Riel @Carl Love 

Thank you so much for your responses! The code by Joe works great. With the mini-example by Joe and the code by Carl (implemented in Maple 2020), I'm getting the error message "Error, invalid sequence".
 

 @Carl Love

I've experimented with datatype= anything before turning to datatype=indexed and was getting the same issue as described by @Joe Riel

To give you a complete picture of my problem: The entries of the matrix that I am trying to import are either multiplicatively connected terms of the type "a[1, 2, 3, 4] * b [5, 6, 7]" (where [1, 2, 3, 4] are the subscripts of a and [5, 6, 7] the subscripts of b), or zeroes. I really appreciate your help.

@Carl Love 

Unfortunately, it didn't work: Now I'm getting the error message: "Error, (in ImportMatrix) unable to store '"a[1, 2, 3, 4]"' when datatype=algebraic". 

1 2 3 4 Page 4 of 4