Message Boards Message Boards

0
|
2655 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Assigning some results after a solve procedure to a matrix

Posted 10 years ago

Hello,

I have a matrix M[3,3]. After a solve procedure, I obtained these results.

{{M[1, 2] -> Cos[?[t]], M[1, 3] -> 0, M[2, 3] -> 0, Cos[?[t]] -> M[3, 1], M[3, 2] -> 0, M[3, 3] -> 1, M[2, 1] -> -Cos[?[t]] Sin[?[t]], M[2, 2] -> Sin[?[t]], M[1, 1] -> Sin[?[t]] Sin[?[t]]}}

I would like to assign the all the parameters M[1,1], M[1,2], ... to the coefficients of my matrix.

Here my code :

Thread[Array[M, {3, 3}].? == ?]

 {{M[1, 2] -> Cos[?[t]], M[1, 3] -> 0, M[2, 3] -> 0, 
  Cos[?[t]] -> M[3, 1], M[3, 2] -> 0, M[3, 3] -> 1, 
  M[2, 1] -> -Cos[?[t]] Sin[?[t]], 
  M[2, 2] -> Sin[?[t]], 
  M[1, 1] -> Sin[?[t]] Sin[?[t]]}}

soln = SolveAlways[%, ?]

{{M[1, 2] -> Cos[?[t]], M[1, 3] -> 0, M[2, 3] -> 0, 
  Cos[?[t]] -> M[3, 1], M[3, 2] -> 0, M[3, 3] -> 1, 
  M[2, 1] -> -Cos[?[t]] Sin[?[t]], 
  M[2, 2] -> Sin[?[t]], 
  M[1, 1] -> Sin[?[t]] Sin[?[t]]}}

matrix = Array[M, {3, 3}]

{{M[1, 1], M[1, 2], M[1, 3]}, {M[2, 1], M[2, 2], M[2, 3]}, {M[3, 1], 
  M[3, 2], M[3, 3]}}

M = matrix /. soln

Here the coefficients are not well assigned as you could see :

Hold[{{Sin[?[t]] Sin[?[t]], Cos[?[t]], 
   0}, {-Cos[?[t]] Sin[?[t]], Sin[?[t]], 
   0}, {M[3, 1], 0, 1}}]

How can I assign the different coefficients obtained in order to be able to evaluate the matrix M ?

I use Mathematica 10, so may be the Values function can be useful but I didn't manage to use it correctly for this purpose for the moment.

In fact, the function SolveAlways give me some rules but sometimes, these rules are not in the good direction (Cos[?[t]] -> M[3, 1]). Consequently, I believe that it is the cause of the difficulty I meet link to the assignments of the coefficients of the matrix.

Thanks a lot for your help

POSTED BY: B B
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract