2
votes

I was hoping to use the symbolic toolbox to simplify or rearrange matrix equations, but it seems to always want to blow matrices out into individual components. Does anyone know if it's possible?

As an example, if would be great if it could recognize stuff like this:

http://en.wikipedia.org/wiki/Binomial_inverse_theorem

using matrix/vector variables. Or compute vector based derivatives: v'*M*v -> 2*v'*M, etc.

Can it be done? Or can I tell symbolic that M is a 4x4 without giving it individual elements, or even having to see individual elements in the results?

1
Thanks for the reply. What I was trying to do was not specify the interior (a,b,c,d). For example, I'd like to tell it M is 4x4 and v is 4x1 and be able to do diff(v'Mv,v) and have it tell me the answer in matrix terms instead of expanding it to components. I hope that makes sense. Sometimes the answers are compact in matrix notation but complex when expanded and you can't see the patterns by eye.Mastiff
I don't know if the comment is for my answer or not. But as I see no other replies, I will assume it is. If it is , please add the comment to the appropriate answer . You can also use latex to add clear equations in the original equation, so one can understand what you really mean. are M and v function of other variables, i.e x...?user2536125

1 Answers

1
votes

Does the following example answer your question?

>> syms a b c d
>> A=[a b ; c d] 

    A =

    [ a, b]
    [ c, d]

>> inv(A)



    ans =

    [  d/(a*d - b*c), -b/(a*d - b*c)]
    [ -c/(a*d - b*c),  a/(a*d - b*c)]

>> 

of course, it goes without saying that you will need the symbolic toolbox license. For a first start; try MuPad which offers a nice graphical user interface and examples in Matlab.