Question: Why code not work?

My code

checkInSet := proc(L, x)
    local i;
    if nops(L) = 0 then
        return 0;
    else    
        for i from 1 to nops(L) do
            if x = L[i] then
                return i;
            fi;
        end;
    end;
end proc:

 

Let

M := {(a-2*b-2*c)^2*(2*a-b+2*c)^2, (a-2*b-c)^2*(a-b+2*c)^2, (a-2*b+c)^2*(a+b-2*c)^2, (a-2*b+2*c)^2*(2*a+b-2*c)^2, (a-b-2*c)^2*(2*a-b+c)^2, (a-b-c)^2*(a-b+c)^2, (a-b+c)^2*(a+b-c)^2, (a-b+2*c)^2*(2*a+b-c)^2, (a+b-2*c)^2*(2*a-b-c)^2};

 

But checkInSet(M, (a-2*b-2*c)^2*(2*a-b+2*c)^2) not work? Someone please help me.

Thanks you very much.

Please Wait...