Question: Error, (in Lfh) invalid subscript selector

after running the code below, run

f2:=[ x3^2, x3*x2];
g2:=[0,-1,1];
h2:=[x1,0,0];
Lf2h := Lfh(1,h2,f2, varlist);

got


Error, (in Lfh) invalid subscript selector

can not see where is wrong

 

Code:

 

restart;

with(combinat):

list1 := permute([a, b, a, b, a, b], 3);

list1a := subs(b=1,subs(a=0, list1));

n := 3;

list1a := permute([seq(seq(k,k=0..1),k2=1..n)], n);

list2 := permute([a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h], 3);

list3 := subs(h=18,subs(g=17,subs(f=16,subs(e=15,subs(d=14,subs(c=13,subs(b=12,subs(a=11,list2))))))));

list3 := permute([seq(seq(k,k=11..18),k2=1..3)], 3);

Iter:= iterstructs(Permutation([seq(seq(k,k=11..(10+nops(list1a))),k2=1..3)]), size=3):

list3b := [];

while not Iter[finished] do

     p:= Iter[nextvalue]();

     list3b := [p, op(list3b)];

end do:

list5 := Matrix(nops(list1a)*nops(list3), 1);

count := 1;

for n from 1 to nops(list3) do

        temp1 := subs(1=list1a[1],list3[n]);

        for k from 11 to nops(list1a)+10 do

                temp1 := subs(k=list1a[k-10],temp1);

        od;

        list5[count] := temp1;

        count := count + 1;

od;

Lfh := proc(numoflevel, hx, fx, var)

if numoflevel = 1 then

        hello := 0;

        for kk from 1 to nops(var) do

                hello := hello + diff(hx[kk], var[kk])*fx[kk];

        od;

        return hello;

else

        hello := 0;

        for kk from 1 to nops(var) do

                hello := hello + diff(Lfh(numoflevel-1, hx, fx, var), var[kk])*fx[kk];

        od;

        return hello;

end if;

end proc:

CheckRelativeRankZero := proc(h1, f1, g1,variables1,Count)

IsFinish := 0;

for ii from 1 to 8 do

        if IsFinish = 0 then

        Lf2h := Lfh(ii,h1,f1,variables1);

        Lgf2h := Lfh(1,[seq(Lf2h,n=1..nops(variables1))],g1,variables1);

        if Lgf2h = 0 then

                print(f1);

                print(Lf2h);

                print("find at ", ii);

                IsFinish := 1;

                return Lf2h;

        end if;

        end if;

od;

return 0;

end proc:

IsZeroMatrix := proc(h1)

Iszero := 1;

for ii from 1 to 3 do

for jj from 1 to 3 do

        if h1[ii][jj] <> 0 then

                        Iszero := 0;

        end if

        od;

od;

return Iszero;

end proc:

with(combstruct):

list6:= convert(list5, list):

list7 := [];

for ii from 1 to nops(list6) do

if list6[ii] <> 0 then

        list7 := [list6[ii], op(list7)];

        end if;

od;

with(LinearAlgebra):

with(VectorCalculus):

varlist := [x1, x2, x3];

Iter:= iterstructs(Permutation(list7), size=2):

Count := 1;

Please Wait...