Extract matrix from complicated symbolic vector

Posted 10 years ago
2658 Views
|
2 Replies
|
2 Total Likes
|
 Hi everyone,I'm looking for a way to extract some kind of matrix representation of a vector that contains some complicated formulae. So as a simple example, let's say I have a vector a that isx = {{(1-a)*(b+d)},{(1-a)*3*c},{(1-a)*d}};from which I now want a matrix representation that isx=(1-a)*{{1,0,1},{0,3,0},{0,0,1}}.{{b},{c},{d}};Any help is much appreciated.
2 Replies
Sort By:
Posted 10 years ago
 Is there a name for this decomposition. I am not sure exactly what this would entail.  For any matrix there's a huge number of ways you could rewrite it. If you can be more precise about what the program should do, that would help us figure out how it could be written. The first thing you'd want to do is identify common factors:x = {(1 - a)*(b + d), (1 - a)*3*c, (1 - a)*d};FactorList /@ x{{{-1, 1}, {-1 + a, 1}, {b + d, 1}}, {{-3, 1}, {-1 + a, 1}, {c, 1}}, {{-1, 1}, {-1 + a, 1}, {d, 1}}}We only want the factors and not their powers and then to take their intersection:factors = Map[FactorList, x][[All, All, 1]]Intersection @@ factorsThis gives (-1+a) as a common factor which we can remove. Note this doesn't give  numeric common factors which would have to be handled separately.
Posted 10 years ago
 No, this no specific decomposition. I just used this as a simple example of what I wanted to achieve. That is, to find some sort of matrix representation for varying complicated formulas in vectors, s.t. these can be calculated faster with matrix-based programming languages like Matlab.But, thanks, your response already helped me a lot.