Message Boards Message Boards

0
|
2781 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Extract matrix from complicated symbolic vector

Posted 11 years ago
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 is
x = {{(1-a)*(b+d)},{(1-a)*3*c},{(1-a)*d}};
from which I now want a matrix representation that is
x=(1-a)*{{1,0,1},{0,3,0},{0,0,1}}.{{b},{c},{d}};
Any help is much appreciated.
2 Replies
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 @@ factors
This 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 BY: Sean Clarke
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.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract