2 added 1260 characters in body
source | link

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.

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.

Thank you for your help


Thank you for your help. But, I have still some difficulties. 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 a difficulties link to the assignments of the coefficients of the matrix.

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

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

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.

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.

Thank you for your help

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.

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.

Thank you for your help


Thank you for your help. But, I have still some difficulties. 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 a difficulties link to the assignments of the coefficients of the matrix.

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

Hold[{{Sin[θ[t]] Sin[ψ[t]], Cos[ψ[t]], 
   0}, {-Cos[ψ[t]] Sin[θ[t]], Sin[ψ[t]], 
   0}, {M[3, 1], 0, 1}}]
1
source | link

Assigning some results after a solve procedure to the coefficients of a matrix

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.

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.

Thank you for your help