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.
fix_issu.patch
Description: Binary data
simpleTest.py
Description: Binary data
