teste

ORDERING

  • This file provides a non-standard ordering for the monomials in the cubic algebra. The order is
  1. U < V < U^2 < V^2;
  2. syllable length of monomials;
  3. total length;
  4. reverse lexicographical ordering.

 

ORDERING:=function(strg1, strg2)
local s1, s2, syl1, syl2, deg1, deg2, degV1, degV2, s1r, s2r, ind ;

s1:=ReplacedString( MON_STRG( STRETCH(strg1)), "*", "");
s2:=ReplacedString( MON_STRG( STRETCH(strg2)), "*", "");

if s1="UU" and s2="V" then return true;fi;

syl1:=1;
for  ind  in [1..Size(s1)-1] do
    if s1[ind] <> s1[ind+1] then
        syl1:=syl1+1;
    fi;
od;

syl2:=1;
for  ind in  [1..Size(s2)-1] do
    if s2[ind] <> s2[ind+1] then
        syl2:=syl2+1;
    fi;
od;

deg1:=Size(s1);
deg2:=Size(s2);
degV1:=Size(ReplacedString(s1, "U", ""));
degV2:=Size(ReplacedString(s2, "U", ""));

s1r:=Reversed(s1);
s2r:=Reversed(s2);
s1r:=ReplacedString(s1r, "UU", "B");
s1r:=ReplacedString(s1r, "VV", "D");
s1r:=ReplacedString(s1r, "U", "A");
s1r:=ReplacedString(s1r, "V", "C");
s2r:=ReplacedString(s2r, "UU", "B");
s2r:=ReplacedString(s2r, "VV", "D");
s2r:=ReplacedString(s2r, "U", "A");
s2r:=ReplacedString(s2r, "V", "C");

if syl1 < syl2 then
    return true;
elif syl1 = syl2 and deg1 < deg2 then
    return true;
elif syl1 = syl2 and deg1=deg2 and degV1 < degV2 then
    return true;
elif  syl1 = syl2 and deg1=deg2 and degV1 = degV2 and s1r < s2r then
    return true;
else  
    return false;
fi;
end;