Repository: sympy/sympy

Issue:
Incorrectly generated positive roots for E_n
The positive roots generated in the CartanType for type E_n are not correct. The same list object is being added to the dictionary causing all of the roots generated in the last section to be the same.

Discussion:

Patch:
diff --git a/.mailmap b/.mailmap
index 4478e02276..03df810c1f 100644
--- a/.mailmap
+++ b/.mailmap
@@ -474,6 +474,7 @@ Colleen Lee <colleenclee@gmail.com> <clee@coursera.org>
 Comer Duncan <comer.duncan@gmail.com>
 Congxu Yang <u7189828@anu.edu.au>
 Constantin Mateescu <costica1234@me.com>
+Corbet Elkins <corbet286@gmail.com>
 Corey Cerovsek <corey@cerovsek.com>
 Costor <pcs2009@web.de>
 Craig A. Stoudt <craig.stoudt@gmail.com>
diff --git a/sympy/liealgebras/type_e.py b/sympy/liealgebras/type_e.py
index c8271c29eb..d73defe534 100644
--- a/sympy/liealgebras/type_e.py
+++ b/sympy/liealgebras/type_e.py
@@ -106,8 +106,7 @@ def positive_roots(self):
                     root[i] = 1
                     posroots[k] = root
 
-            root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
-                    Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
+            root = [Rational(1, 2)]*5 + [Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
             for a in range(0, 2):
                 for b in range(0, 2):
                     for c in range(0, 2):
@@ -125,7 +124,7 @@ def positive_roots(self):
                                         root[3] = Rational(-1, 2)
                                     if e == 1:
                                         root[4] = Rational(-1, 2)
-                                    posroots[k] = root
+                                    posroots[k] = root[:]
 
             return posroots
         if n == 7:
@@ -143,8 +142,7 @@ def positive_roots(self):
 
             k += 1
             posroots[k] = [0, 0, 0, 0, 0, 1, 1, 0]
-            root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
-                    Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
+            root = [Rational(1, 2)]*5 + [Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
             for a in range(0, 2):
                 for b in range(0, 2):
                     for c in range(0, 2):
@@ -165,7 +163,7 @@ def positive_roots(self):
                                             root[4] = Rational(-1, 2)
                                         if f == 1:
                                             root[5] = Rational(1, 2)
-                                        posroots[k] = root
+                                        posroots[k] = root[:]
 
             return posroots
         if n == 8:
@@ -181,8 +179,7 @@ def positive_roots(self):
                     root[i] = 1
                     posroots[k] = root
 
-            root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
-                    Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
+            root = [Rational(1, 2)]*5 + [Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
             for a in range(0, 2):
                 for b in range(0, 2):
                     for c in range(0, 2):
@@ -206,7 +203,7 @@ def positive_roots(self):
                                                 root[5] = Rational(1, 2)
                                             if g == 1:
                                                 root[6] = Rational(1, 2)
-                                            posroots[k] = root
+                                            posroots[k] = root[:]
 
             return posroots
 


Test patch:
diff --git a/sympy/liealgebras/tests/test_type_E.py b/sympy/liealgebras/tests/test_type_E.py
index 95bb23e205..bdb08342f4 100644
--- a/sympy/liealgebras/tests/test_type_E.py
+++ b/sympy/liealgebras/tests/test_type_E.py
@@ -1,5 +1,6 @@
 from sympy.liealgebras.cartan_type import CartanType
 from sympy.matrices import Matrix
+from sympy.core.backend import Rational
 
 def test_type_E():
     c = CartanType("E6")
@@ -17,3 +18,5 @@ def test_type_E():
     assert c.dynkin_diagram() == diag
     posroots = c.positive_roots()
     assert posroots[8] == [1, 0, 0, 0, 1, 0, 0, 0]
+    assert posroots[21] == [Rational(1,2),Rational(1,2),Rational(1,2),Rational(1,2),
+                            Rational(1,2),Rational(-1,2),Rational(-1,2),Rational(1,2)]