2
$\begingroup$

I have the following constraints equations :

SysCon = {-(1/2) l Cos[γ[t]] + Subscript[x, G][t] == 
   0, -(1/2) l Sin[γ[t]] + Subscript[y, G][t] == 0}

I would like to manipulate these expressions so as to obtain the equations in the following form :

$$ \phi _{q_d} \dot{q}_d+\phi _{q_i}\dot{q}_i$$

with $q_i = \gamma$ and $q_d = \{x_G, y_G\}$ and determine the matrix before $q_i$ and $q_d$.

May you help me to conduct this manipulation ?

I have tried without success the Dt function.

$\endgroup$
  • $\begingroup$ Perfect! You help me a lot. It answers to my question. However, how is it possible to generalize so that I can use directly my list qi and qd : mat[[All, {1}]] mat[[All, 2 ;; 3]] I found in the help the function Position[ ] but It doesn't work. For example, I would like to obtain from a vector qd such as {xG,yG} a list of elements {1,2} $\endgroup$ – Bendesarts Nov 12 '15 at 7:55
  • $\begingroup$ Pls remember to add the comments relevant to an answer with it (e.g. mat refers to something in the answer and not in the question.) I am not quite sure what you are asking, because it appears trivial what you are trying to do. I will update the answer. Hope that's what you want. $\endgroup$ – Suba Thomas Nov 12 '15 at 15:28
2
$\begingroup$

This is the complete matrix

mat = D[First /@ SysCon, {{γ[t], Subscript[x, G][t], Subscript[y, G][t]}}]

enter image description here

and these are the individual matrices

mat[[All, {1}]]

enter image description here

mat[[All, 2 ;; 3]]

enter image description here

Update

Generalizing a bit:

eqns = SysCon /. Equal[lhs_, rhs_] :> lhs - rhs;
Subscript[q, i] = {γ};
Subscript[q, d] = {Subscript[x, G], Subscript[y, G]};
toT[var : _[t]] := var
toT[var_] := var[t]

The matrices:

{Subscript[ϕ, Subscript[q, i]], Subscript[ϕ, Subscript[q,  d]] } = 
D[eqns, {toT /@ #}] & /@ {Subscript[q, i], Subscript[q, d]};
MatrixForm /@ %

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.