So, the simple answer is that SymPy doesn't currently support matrix
exponentials. I.e. we don't support expressions of the type a**B where B is
a matrix.

When designing matrix expressions a choice was made to subclass from the
normal expression class. This means that a lot of things from normal sympy
work perfectly on matrix expressions without any additional code.
Unfortunately some things that should raise errors go through, treating the
matrix as a normal scalar symbol. Your case with exp(B) is such an example.

I've created an issue for this
http://code.google.com/p/sympy/issues/detail?id=3119

<http://code.google.com/p/sympy/issues/detail?id=3119>For your immediate
problem it's possible you could find a solution. You've gotten surprisingly
far already. Whenever you multiply by I you're forcing sympy to turn the
expression back into a matrix. Are you working off of a git branch
somewhere?

-Matt

On Wed, Feb 29, 2012 at 10:29 AM, saupin guillaume <
[email protected]> wrote:

> Hello,
>
>
> I'm trying to use MatrixSymbol to do some computation.
>
> More precisely, I have a function f(q1, q2) = e(A*q1) * e(B*q2), where
>
> * q1, q2 are real
> * A, B are 3x3 matrices
> * e(M) is the matrix exponential
>
> I want to compute  F = df(q1, q2) / dq2 * f(q1, q2)**-1
>
> F = e(A*q1) * B*e(B*q2) * (e(A*q1) * e(B*q2))**-1
> F = e(A*q1) * B*e(B*q2) * (e(-B*q2) * e(-A*q1)
>
> that can be simplified to
>
> F = e(A*q1) * B * e(-A*q1)
>
> I tried to make these simple computations using sympy and the
> MatrixSymbol. I had to make some modification inside core/mul.py so that
> the diff() method works on MatrixSymbol.
>
> With the followind code I almost manage to get a satisfying resuls, except
> for the final simplifiaction that does not work :(
>
>
> from sympy import *
> from sympy.matrices import *
>
> q1 = Symbol('q1')
> q2 = Symbol('q2')
> q3 = Symbol('q3')
>
>
> A = MatrixSymbol('A', 3, 3)
> B = MatrixSymbol('B', 3, 3)
> I = Identity(3)
>
> print (A*B)**-1
> print (exp(q1*A)*exp(q2*B))**-1 # the inversion is not computed
> print (exp(q1*A)*exp(q2*B) * I)**-1 #inversion is computed if we add I
> print (exp(q1*A)*exp(q2*B) * I).diff(q1) * (exp(q1*A)*exp(q2*B) * I)**-1 #
> The expression is not simplified-1
>
> Any ideas ?
> --
> guillaume saupin
>
>
>
> --
> guillaume saupin
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to