MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

CoeffExtract — Extracting a coefficient array [mathematica]

CoeffExtract[desc, {s1, ..., sn}]

desc: Mambo column description

s1, ..., sn: variable names

The function CoeffExtract returns a Mambo description with number of rows equal to the number of rows of its first argument and number of columns equal to the number of variable names.

The (i,j)-th element of the output equals the coefficient of the j-th variable in the i-th row of the first argument.

Restart;
DeclareObservers[A];
DeclarePoints[A,P];
DeclareTriads[a];
DefineObservers[A,A,a];
DefinePoints[A,P,a,q1,q2,q3];
DeclareStates[q1,q2,q3];
kde=Union[{DiffTime[q1^2+q2^2+q3^2]==0},{q1'==u1,q2'==u2}];
kde=Solve[kde,Table[Symbol["q"<>ToString[i]]',{i,3}]]//Flatten;
vel=VelocityDescription[{LinearVelocity[A,P]/.kde}]

{ Type "->" Description , Size "->" { 1 , 1 } , { 1 , 1 } "->" { Type "->" Vector , Size "->" 1 , 1 "->" { Coordinates "->" { u1 , u2 , - q1 u1 + q2 u2 q3 } , Triad "->" a } } }

CoeffExtract[vel,{u1, u2}]

{ Type "->" Description , Size "->" { 1 , 2 } , { 1 , 1 } "->" { Type "->" Vector , Size "->" 1 , 1 "->" { Coordinates "->" { 1 , 0 , - q1 q3 } , Triad "->" a } } , { 1 , 2 } "->" { Type "->" Vector , Size "->" 1 , 1 "->" { Coordinates "->" { 0 , 1 , - q2 q3 } , Triad "->" a } } }


Toolbox functions