Weby shortcut
teste

STRETCH

  • Given a non-commutative monomial written as a string, this function returns a non-commutative monomial, but this is represented without powers, for example

gap>STRETCH("V^3*U^2");

"V*V*V*U*U"

gap>



STRETCH:=function(strg_mon)
local mon, siz_mon, i, j;

mon:=GP2NP( EvalString(strg_mon) );
siz_mon:=Size(mon[1]);

for i in [1..siz_mon] do
    for j in [1..Size(mon[1][i])] do
        mon[1][i][j] := lvar[ mon[1][i][j] ];
    od;
od;

for i in [1..siz_mon] do
    mon[2][i] := Concatenation( "(", String(mon[2][i]), ")" );
od;

mon[1]:= List(mon[1], i-> JoinStringsWithSeparator(i, "*"));
mon:=List([1..siz_mon], i-> Concatenation(mon[2][i], "*", mon[1][i]));



return JoinStringsWithSeparator(mon, "+");

end;

Listar Todas Voltar