/* * Step2: * Given a list L = [u,[b_1,...,b_l]], representing the positiv form of a braid (L) in the braid group B_N, * this programm splits the list B = [b_1,...,b_l] into several lists X = [x_1,...,x_i], Y = [y_1,...,y_j],..., Z = [z_1,...,z_k], * such that b_1...b_l = x_1...x_iy_1...y_j...z_1...z_k (letter by letter) and X,Y,...,Z represent canonicle factors (X),(Y),...,(Z). * We call the resulting list L = [u,X,Y,...,Z] the almost normal form of the braid (L). * * input: N positiv integer (represents the braid index), L list (represents the positive form of a braid in B_N) * output: L list (represents the almost normal form of the input braid (L)) */ Define Step2(N,L) If L[2] = [] Then Return L; EndIf; B := L[2]; NewL := []; TempL := []; For I:=1 To Len(B) Do Append(TempL,B[I]); If NOT IsCanonical(N,TempL) Then Remove(TempL,Len(TempL)); Append(NewL,TempL); TempL := [B[I]]; EndIf; EndFor; Insert(NewL,1,L[1]); L := NewL; Append(L,TempL); Return L; EndDefine; Define Step21(N,L) If L[2] = [] Then Return L; EndIf; B := L[2]; NewL := []; TempL := []; For I:=1 To Len(B) Do If Type(B[I]) = INT Then Append(TempL,B[I]); If NOT IsCanonical(N,TempL) Then Remove(TempL,Len(TempL)); Append(NewL,Pi(N,TempL)); TempL := [B[I]]; EndIf; Else If TempL <> [] Then Append(NewL,Pi(N,TempL)); EndIf; Append(NewL,B[I]); TempL := []; EndIf; EndFor; Insert(NewL,1,L[1]); If Type(B[Len(B)]) <> LIST Then Append(NewL,Pi(N,TempL)); EndIf; Return NewL; EndDefine;