A root systems short algorithm : "ValueError: too many values to unpack"

27 views
Skip to first unread message

Sarah DIJOLS

unread,
Aug 19, 2020, 8:15:56 AM8/19/20
to sage-support

Hello,
I am running the following code (part of an ongoing math project):

e = RootSystem(['E',6]).ambient_space()
Roots = e.roots()
 
a1 = vector((1/2, -1/2, -1/2, -1/2, -1/2, -1/2, -1/2, 1/2))
a2 = vector((1, 1, 0, 0, 0, 0, 0, 0))
a3 = vector((-1, 1, 0, 0, 0, 0, 0, 0))
a4 = vector((0, -1, 1, 0, 0, 0, 0, 0))
a5 = vector((0, 0, -1, 1, 0, 0, 0, 0))
a6 = vector((0, 0, 0, -1, 1, 0, 0, 0))

Lini = [a1, a2, a3, a4, a5]

def proj(t, ai):
    myLone = vector(ai)
    result= t - myLone.dot_product(t) / (ai.dot_product(ai))*myLone
    return result

myP = [proj(x, a6) for x in Lini]
[proja1, proja2, proja3, proja4, proja5] = myP

myR = [vector(v) for v in Roots]
myL = [proj(x, a6) for x in myR]
len(myL)

# produce all combinaisons of five vectors  with 2 vectors in myL and 3 in myP
myPlist1= Combinations(myP, 3).list()
myLlist1= Combinations(myL, 2).list()

 
#Alternatively I would have like to use 5 vectors combinaisons in another function of mine but again it seems the error of "too many values" unable me to do so :
#myLlist= Combinations(myL, 5).list()

def letsapply(listg, alist):
    for listel in listg:
        myPset1= set(tuple(v) for v in listel)
        print(myPset1)
    for listel2 in alist:
        myLset1= set(tuple(v) for v in listel2)
        print(myLset1)
        myLset1= myLset1.union(myPset1)

        if len(myLset1) >= 5:
            print(myLset1, "myLset1")

        if len(myLset1) >= 5:
            for myLel in myLset1:
                [proja1, proja2, proja3, proja4, proja5] = myLel
                print(myLel)

print(letsapply(myPlist1,myLlist1))

Is there a way to handle this "capacity" issue? I am quite new to SAGE, I have been using it on cocalc and with Jupyter. Thanks a lot for your help.
Best,
Sarah Dijols (Math postdoc in Tsinghua University)



rickhg12hs

unread,
Aug 19, 2020, 9:29:38 PM8/19/20
to sage-support
> [proja1, proja2, proja3, proja4, proja5] = myLel

Here you are setting a list of 5 variables to a tuple of 8 elements?

Did you want to call your `proj` function before this?

Reply all
Reply to author
Forward
0 new messages