Ask Your Question

solving matrix equation

asked 2015-05-30 08:59:56 -0500

Nownuri1 gravatar image

updated 2015-05-31 01:01:35 -0500

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)]])


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


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



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

answered 2015-05-31 04:46:38 -0500

FrédéricC gravatar image

updated 2015-06-04 13:46:38 -0500

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.


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


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-01 23:39:24 -0500 )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


Asked: 2015-05-30 08:59:56 -0500

Seen: 393 times

Last updated: Jun 04 '15