Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Root systems algorithm: "TypeError: 'str' object is not callable"

I am rather new to SAGE and formal language. I am running the following code which works fine with a slighty simpler version (where the variables p1,p2,...p5 in the function letsapply are fixed): Here is the original function that works fine:

def letsapply(listg, alist):
    mylistg = listg
    mylistg.reverse()
    for si in mylistg:
        if si == 's1':
            alist = map(s1, alist)
        elif si == 's2':
            alist = map(s2, alist)
        elif si == 's3':
            alist = map(s3, alist)
        elif si == 's4':
            alist = map(s4, alist)
        elif si == 's5':
            alist = map(s5, alist)
        elif si == 's6':
            alist = map(s6, alist)
        else:
            print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts

Below, I am getting the following "TypeError: 'str' object is not callable". Could anyone helps me fixe this? Thanks a lot!

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]

 ## alist is the set of all projections of roots in E6

 myR = [vector(v) for v in Roots]


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

  myL = [proj(x, a6) for x in myR]


 def si(t, projai):
       myLone = projai
       result = t- 2*myLone.dot_product(t)/(projai.dot_product(projai))*myLone
      return result

  def decompose(g, mylength):
  # g is a str(aa) where aa belongs to list(WeylGroup ...)
      listg = [g[3*i]+ g[3*i+1] for i in range(0, mylength)]
      return listg

  def letsapply(listg, alist, p1, p2, p3, p4, p5):
      mylistg = listg
      mylistg.reverse()
      for si in mylistg:
           if si == 's1':
            alist = map(lambda w: si(w, p1), alist)
          elif si == 's2':
           alist = map(lambda w: si(w, p2), alist)
         elif si == 's3':
            alist = map(lambda w: si(w, p3), alist)
         elif si == 's4':
            alist = map(lambda w: si(w, p4), alist)
          elif si == 's5':
            alist = map(lambda w: si(w, p5), alist)
         else:
             print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts


   def main():
   W = WeylGroup(["A", 5], prefix="s")
   listW = list(W)
   # We remove the first element which is 1:
   listW.pop(0)
   listWdecomposed = [decompose(str(g), g.length()) for g in listW]

   e = RootSystem(['E',6]).ambient_space()
   Roots = e.roots()
   ## get all projections of roots in E6
   myR = [vector(v) for v in Roots]
   myL = [proj(x, a6) for x in myR]
   print("myL =", myL)
   # produce all combinaisons in myL of five vectors,
   # and apply the procedure to them: the procedure consists first in writing
  # the Weyl group associated to any five elements in myL (call any : myLel), then applying these elements si to myLel

  myLlist= Combinations(myL, 5).list()
  for myLel in myLlist:
        [proja1, proja2, proja3, proja4, proja5] = myLel
   res = set(tuple(v) for v in myLel)
  for listg in listWdecomposed:
        res = res.union(letsapply(listg, myLel, proja1, proja2, proja3, proja4, proja5))

        # Reconvert :
       res = [vector(v) for v in res]
       res.sort()

      if len(res)< 30:
         return(len(res), res)
     else:
        print("too many vectors in this subspace")
     return 0  
     main()

Root systems algorithm: "TypeError: 'str' object is not callable"

I am rather new to SAGE and formal language. language.

I am running the following code which works fine with a slighty simpler version (where the variables p1,p2,...p5 in the function letsapply are fixed): Here fixed); here is the original function that works fine:

def letsapply(listg, alist):
    mylistg = listg
    mylistg.reverse()
    for si in mylistg:
        if si == 's1':
            alist = map(s1, alist)
        elif si == 's2':
            alist = map(s2, alist)
        elif si == 's3':
            alist = map(s3, alist)
        elif si == 's4':
            alist = map(s4, alist)
        elif si == 's5':
            alist = map(s5, alist)
        elif si == 's6':
            alist = map(s6, alist)
        else:
            print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts

Below, I am getting the following "TypeError: 'str' object is not callable". Could anyone helps me fixe this? Thanks a lot!

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]

 ## alist is the set of all projections of roots in E6

 myR = [vector(v) for v in Roots]


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

  myL = [proj(x, a6) for x in myR]


 def si(t, projai):
       myLone = projai
       result = t- 2*myLone.dot_product(t)/(projai.dot_product(projai))*myLone
      return result

  def decompose(g, mylength):
  # g is a str(aa) where aa belongs to list(WeylGroup ...)
      listg = [g[3*i]+ g[3*i+1] for i in range(0, mylength)]
      return listg

  def letsapply(listg, alist, p1, p2, p3, p4, p5):
      mylistg = listg
      mylistg.reverse()
      for si in mylistg:
           if si == 's1':
            alist = map(lambda w: si(w, p1), alist)
          elif si == 's2':
           alist = map(lambda w: si(w, p2), alist)
         elif si == 's3':
            alist = map(lambda w: si(w, p3), alist)
         elif si == 's4':
            alist = map(lambda w: si(w, p4), alist)
          elif si == 's5':
            alist = map(lambda w: si(w, p5), alist)
         else:
             print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts


   def main():
   W = WeylGroup(["A", 5], prefix="s")
   listW = list(W)
   # We remove the first element which is 1:
   listW.pop(0)
   listWdecomposed = [decompose(str(g), g.length()) for g in listW]

   e = RootSystem(['E',6]).ambient_space()
   Roots = e.roots()
   ## get all projections of roots in E6
   myR = [vector(v) for v in Roots]
   myL = [proj(x, a6) for x in myR]
   print("myL =", myL)
   # produce all combinaisons in myL of five vectors,
   # and apply the procedure to them: the procedure consists first in writing
  # the Weyl group associated to any five elements in myL (call any : myLel), then applying these elements si to myLel

  myLlist= Combinations(myL, 5).list()
  for myLel in myLlist:
        [proja1, proja2, proja3, proja4, proja5] = myLel
   res = set(tuple(v) for v in myLel)
  for listg in listWdecomposed:
        res = res.union(letsapply(listg, myLel, proja1, proja2, proja3, proja4, proja5))

        # Reconvert :
       res = [vector(v) for v in res]
       res.sort()

      if len(res)< 30:
         return(len(res), res)
     else:
        print("too many vectors in this subspace")
     return 0  
     main()

Root systems algorithm: "TypeError: 'str' object is not callable"

I am rather new to SAGE and formal language.

I am running the following code which works fine with a slighty simpler version (where the variables p1,p2,...p5 in the function letsapply are fixed); here is the original function that works fine:

 def letsapply(listg, alist):
    mylistg = listg
    mylistg.reverse()
    for si in mylistg:
        if si == 's1':
            alist = map(s1, alist)
        elif si == 's2':
            alist = map(s2, alist)
        elif si == 's3':
            alist = map(s3, alist)
        elif si == 's4':
            alist = map(s4, alist)
        elif si == 's5':
            alist = map(s5, alist)
        elif si == 's6':
            alist = map(s6, alist)
        else:
            print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts

Below, I am getting the following "TypeError: 'str' object is not callable". Could anyone helps me fixe this? Thanks a lot!

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]

 ## alist is the set of all projections of roots in E6

 myR = [vector(v) for v in Roots]


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

  myL = [proj(x, a6) for x in myR]


 def si(t, projai):
       myLone = projai
       result = t- 2*myLone.dot_product(t)/(projai.dot_product(projai))*myLone
      return result

  def decompose(g, mylength):
  # g is a str(aa) where aa belongs to list(WeylGroup ...)
      listg = [g[3*i]+ g[3*i+1] for i in range(0, mylength)]
      return listg

  def letsapply(listg, alist, p1, p2, p3, p4, p5):
      mylistg = listg
      mylistg.reverse()
      for si in mylistg:
           if si == 's1':
            alist = map(lambda w: si(w, p1), alist)
          elif si == 's2':
           alist = map(lambda w: si(w, p2), alist)
         elif si == 's3':
            alist = map(lambda w: si(w, p3), alist)
         elif si == 's4':
            alist = map(lambda w: si(w, p4), alist)
          elif si == 's5':
            alist = map(lambda w: si(w, p5), alist)
         else:
             print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)

    return alistts


   def main():
   W = WeylGroup(["A", 5], prefix="s")
   listW = list(W)
   # We remove the first element which is 1:
   listW.pop(0)
   listWdecomposed = [decompose(str(g), g.length()) for g in listW]

   e = RootSystem(['E',6]).ambient_space()
   Roots = e.roots()
   ## get all projections of roots in E6
   myR = [vector(v) for v in Roots]
   myL = [proj(x, a6) for x in myR]
   print("myL =", myL)
   # produce all combinaisons in myL of five vectors,
   # and apply the procedure to them: the procedure consists first in writing
  # the Weyl group associated to any five elements in myL (call any : myLel), then applying these elements si to myLel

  myLlist= Combinations(myL, 5).list()
  for myLel in myLlist:
        [proja1, proja2, proja3, proja4, proja5] = myLel
   res = set(tuple(v) for v in myLel)
  for listg in listWdecomposed:
        res = res.union(letsapply(listg, myLel, proja1, proja2, proja3, proja4, proja5))

        # Reconvert :
       res = [vector(v) for v in res]
       res.sort()

      if len(res)< 30:
         return(len(res), res)
     else:
        print("too many vectors in this subspace")
     return 0  
     main()

Root systems algorithm: "TypeError: 'str' object is not callable"

I am rather new to SAGE Sage and formal language.

I am running the following code which works fine with a slighty simpler version version (where the variables p1,p2,...p5 p1, p2, ..., p5 in the function letsapply letsapply are fixed); here fixed).

Here is the original function that works fine:

 def letsapply(listg, alist):
    mylistg = listg
    mylistg.reverse()
    for si in mylistg:
        if si == 's1':
            alist = map(s1, alist)
        elif si == 's2':
            alist = map(s2, alist)
        elif si == 's3':
            alist = map(s3, alist)
        elif si == 's4':
            alist = map(s4, alist)
        elif si == 's5':
            alist = map(s5, alist)
        elif si == 's6':
            alist = map(s6, alist)
        else:
            print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)
     return alistts

Below, I am getting the following "TypeError: following

TypeError: 'str' object is not callable".
callable

Could anyone helps help me fixe fix this? Thanks a lot!

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]

 ## # alist is the set of all projections of roots in E6

 myR = [vector(v) for v in Roots]

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

 myL = [proj(x, a6) for x in myR]

 def si(t, projai):
       myLone = projai
       result = t- 2*myLone.dot_product(t)/(projai.dot_product(projai))*myLone
      return result

 def decompose(g, mylength):
   # g is a str(aa) where aa belongs to list(WeylGroup ...)
     listg = [g[3*i]+ g[3*i+1] for i in range(0, mylength)]
     return listg

 def letsapply(listg, alist, p1, p2, p3, p4, p5):
     mylistg = listg
     mylistg.reverse()
     for si in mylistg:
         if si == 's1':
            alist = map(lambda w: si(w, p1), alist)
         elif si == 's2':
            alist = map(lambda w: si(w, p2), alist)
         elif si == 's3':
            alist = map(lambda w: si(w, p3), alist)
         elif si == 's4':
            alist = map(lambda w: si(w, p4), alist)
         elif si == 's5':
            alist = map(lambda w: si(w, p5), alist)
         else:
             print("Wrong input in letsapply!!")
    alistt = [tuple(v) for v in alist]
    alistts = set(alistt)
     return alistts

 def main():
    W = WeylGroup(["A", 5], prefix="s")
    listW = list(W)
    # We remove the first element which is 1:
    listW.pop(0)
    listWdecomposed = [decompose(str(g), g.length()) for g in listW]

    e = RootSystem(['E',6]).ambient_space()
    Roots = e.roots()
    ## get all projections of roots in E6
    myR = [vector(v) for v in Roots]
    myL = [proj(x, a6) for x in myR]
    print("myL =", myL)
    # produce all combinaisons in myL of five vectors,
    # and apply the procedure to them: the procedure consists first in writing
   # the Weyl group associated to any five elements in myL (call any : myLel), myLel),
    # then applying these elements si to myLel

   myLlist= Combinations(myL, 5).list()
   for myLel in myLlist:
        [proja1, proja2, proja3, proja4, proja5] = myLel
    res = set(tuple(v) for v in myLel)
   for listg in listWdecomposed:
        res = res.union(letsapply(listg, myLel, proja1, proja2, proja3, proja4, proja5))
         # Reconvert :
Reconvert
        res = [vector(v) for v in res]
        res.sort()
     if len(res)< 30:
         return(len(res), res)
     else:
        print("too many vectors in this subspace")
     return 0  
 0
    main()