Repository: sympy/sympy

Issue:
`pprint(Union, use_unicode=False)` raises error (but `str(Union)` works)
See `printing/pretty/pretty.py`.

1.  Possible fix:
`union_delimiter = ' %s ' % pretty_atom('Union', 'U')`

2.  Similarly, I wonder if lower-case `n` might be an appropriate ascii character for `Intersection`?  If not, at least throw `NotImplemented` like in `SymmetricDifference`.


Discussion:

Patch:
diff --git a/sympy/combinatorics/perm_groups.py b/sympy/combinatorics/perm_groups.py
index b1565fd52f..720abd62d3 100644
--- a/sympy/combinatorics/perm_groups.py
+++ b/sympy/combinatorics/perm_groups.py
@@ -123,10 +123,10 @@ def __new__(cls, *args, **kwargs):
         """The default constructor. Accepts Cycle and Permutation forms.
         Removes duplicates unless ``dups`` keyword is False.
         """
+        args = list(args[0] if is_sequence(args[0]) else args)
         if not args:
-            args = [Permutation()]
-        else:
-            args = list(args[0] if is_sequence(args[0]) else args)
+            raise ValueError('must supply one or more permutations '
+            'to define the group')
         if any(isinstance(a, Cycle) for a in args):
             args = [Permutation(a) for a in args]
         if has_variety(a.size for a in args):
@@ -1568,7 +1568,7 @@ def is_nilpotent(self):
         else:
             return self._is_nilpotent
 
-    def is_normal(self, gr, strict=True):
+    def is_normal(self, gr):
         """Test if G=self is a normal subgroup of gr.
 
         G is normal in gr if
@@ -1590,20 +1590,12 @@ def is_normal(self, gr, strict=True):
         True
 
         """
-        d_self = self.degree
-        d_gr = gr.degree
-        new_self = self.copy()
-        if not strict and d_self != d_gr:
-            if d_self < d_gr:
-                new_self = PermGroup(new_self.generators + [Permutation(d_gr - 1)])
-            else:
-                gr = PermGroup(gr.generators + [Permutation(d_self - 1)])
-        gens2 = [p._array_form for p in new_self.generators]
+        gens2 = [p._array_form for p in self.generators]
         gens1 = [p._array_form for p in gr.generators]
         for g1 in gens1:
             for g2 in gens2:
                 p = _af_rmuln(g1, g2, _af_invert(g1))
-                if not new_self.coset_factor(p, True):
+                if not self.coset_factor(p, True):
                     return False
         return True
 
diff --git a/sympy/combinatorics/permutations.py b/sympy/combinatorics/permutations.py
index cf68727df8..7e7a052247 100644
--- a/sympy/combinatorics/permutations.py
+++ b/sympy/combinatorics/permutations.py
@@ -235,7 +235,7 @@ class Cycle(dict):
     Wrapper around dict which provides the functionality of a disjoint cycle.
 
     A cycle shows the rule to use to move subsets of elements to obtain
-    a permutation. The Cycle class is more flexible than Permutation in
+    a permutation. The Cycle class is more flexible that Permutation in
     that 1) all elements need not be present in order to investigate how
     multiple cycles act in sequence and 2) it can contain singletons:
 
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index 034c977ef6..0f6bc11bd0 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -1496,7 +1496,7 @@ def _print_AccumuBounds(self, i):
 
     def _print_Intersection(self, u):
 
-        delimiter = ' %s ' % pretty_atom('Intersection')
+        delimiter = ' %s ' % pretty_atom('Intersection', 'n')
 
         return self._print_seq(u.args, None, None, delimiter,
                                parenthesize=lambda set: set.is_ProductSet or
@@ -1504,7 +1504,7 @@ def _print_Intersection(self, u):
 
     def _print_Union(self, u):
 
-        union_delimiter = ' %s ' % pretty_atom('Union')
+        union_delimiter = ' %s ' % pretty_atom('Union', 'U')
 
         return self._print_seq(u.args, None, None, union_delimiter,
                                parenthesize=lambda set: set.is_ProductSet or


Test patch:
diff --git a/sympy/combinatorics/tests/test_perm_groups.py b/sympy/combinatorics/tests/test_perm_groups.py
index 3f45083ba7..d8f7118cda 100644
--- a/sympy/combinatorics/tests/test_perm_groups.py
+++ b/sympy/combinatorics/tests/test_perm_groups.py
@@ -60,7 +60,6 @@ def test_order():
     b = Permutation([2, 1, 3, 4, 5, 6, 7, 8, 9, 0])
     g = PermutationGroup([a, b])
     assert g.order() == 1814400
-    assert PermutationGroup().order() == 1
 
 
 def test_equality():
@@ -274,10 +273,6 @@ def test_is_normal():
     assert G1.is_subgroup(G6)
     assert not G1.is_subgroup(G4)
     assert G2.is_subgroup(G4)
-    s4 = PermutationGroup(Permutation(0, 1, 2, 3), Permutation(3)(0, 1))
-    s6 = PermutationGroup(Permutation(0, 1, 2, 3, 5), Permutation(5)(0, 1))
-    assert s6.is_normal(s4, strict=False)
-    assert not s4.is_normal(s6, strict=False)
 
 
 def test_eq():
@@ -722,7 +717,3 @@ def test_elements():
 def test_is_group():
     assert PermutationGroup(Permutation(1,2), Permutation(2,4)).is_group == True
     assert SymmetricGroup(4).is_group == True
-
-
-def test_PermutationGroup():
-    assert PermutationGroup() == PermutationGroup(Permutation())
diff --git a/sympy/printing/pretty/tests/test_pretty.py b/sympy/printing/pretty/tests/test_pretty.py
index 0724493609..ac6d0120a2 100644
--- a/sympy/printing/pretty/tests/test_pretty.py
+++ b/sympy/printing/pretty/tests/test_pretty.py
@@ -3139,6 +3139,20 @@ def test_pretty_ComplexRegion():
     ucode_str = u('{r⋅(ⅈ⋅sin(θ) + cos(θ)) | r, θ ∊ [0, 1] × [0, 2⋅π)}')
     assert upretty(ComplexRegion(Interval(0, 1)*Interval(0, 2*pi), polar=True)) == ucode_str
 
+def test_pretty_Union_issue_10414():
+    a, b = Interval(2, 3), Interval(4, 7)
+    ucode_str = u('[2, 3] ∪ [4, 7]')
+    ascii_str = '[2, 3] U [4, 7]'
+    assert upretty(Union(a, b)) == ucode_str
+    assert pretty(Union(a, b)) == ascii_str
+
+def test_pretty_Intersection_issue_10414():
+    x, y, z, w = symbols('x, y, z, w')
+    a, b = Interval(x, y), Interval(z, w)
+    ucode_str = u('[x, y] ∩ [z, w]')
+    ascii_str = '[x, y] n [z, w]'
+    assert upretty(Intersection(a, b)) == ucode_str
+    assert pretty(Intersection(a, b)) == ascii_str
 
 def test_ProductSet_paranthesis():
     from sympy import Interval, Union, FiniteSet