Ask Your Question
0

solving matrix equation

asked 2015-05-30 15:59:56 +0100

Nownuri1 gravatar image

updated 2015-05-31 08:01:35 +0100

Could anyone please tell me how to solve a matrix equation? In the following code I have an extremely complicated matrix O. But I know that the matrix O equals to P. (I'm deriving what textbook didn't and the textbook said that they are same.)

var('theta, phi, psi, omega_1, omega_2, omega_3, t, f, g, h') #Variables are defined. 

theta=function('theta')(t); phi=function('phi')(t); psi=function('psi')(t);

R1=matrix([[cos(phi), sin(phi),0],[-sin(phi), cos(phi), 0],[0, 0, 1]])

R2=matrix([[1,0,0],[0, cos(theta), sin(theta)],[0, -sin(theta), cos(theta)]])

R3=matrix([[cos(psi),sin(psi),0],[-sin(psi),cos(psi),0],[0,0,1]])

P=matrix([[0,omega_3,-omega_2],[-omega_3, 0, omega_1],[omega_2, -omega_1, 0]])

R=R3*R2*R1

R_T=R.T; R_dev=R.derivative(t)

O=R_dev*R_T

view(O)

assuming that O==P, How can I obtain the omega_1, omega_2, omega_3 as function of theta, phi, psi, t?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-05-31 11:46:38 +0100

FrédéricC gravatar image

updated 2015-06-04 20:46:38 +0100

Use this to simplify the matrix:

O.parent()([x.full_simplify() for x in O.list()])

Then omega_i will just be the coefficients of this simplified matrix.

EDIT:

The command t.full_simplify() tries to simplify t as much as possible and return the result. The rest of the line is the application to the list of matrix coefficients O.list(), and then rebuilding the matrix ; O.parent() is the space of matrices of the correct size over the correct ring. This matrix space can swallow the list and give back a matrix. This could also be done more simply using

O.apply_map(lambda t:t.full_simplify())
edit flag offensive delete link more

Comments

I appreciate for your answer. It works perfectly. But could you please let me know what the code means? The 'parent()()' and 'x.full_simplify()'?

Nownuri1 gravatar imageNownuri1 ( 2015-06-02 06:39:24 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-05-30 15:59:56 +0100

Seen: 619 times

Last updated: Jun 04 '15