Repository: sympy/sympy

Issue:
simplify sometimes does not respect non-commutativity
The following code:
```python
import sympy

a, b = sympy.symbols("a, b", commutative=False)
(sympy.exp(sympy.I * a).adjoint() * sympy.exp(sympy.I * b)).simplify()
```
produces `sympy.exp(sympy.I * b) * sympy.exp(-sympy.I * a.adjoint())`, which is a different expression because `a` and `b` are not commutative.

Discussion:

Patch:
diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py
index 722c6181fe..29953063a4 100644
--- a/sympy/functions/elementary/exponential.py
+++ b/sympy/functions/elementary/exponential.py
@@ -63,6 +63,8 @@ def as_numer_denom(self):
         """
         # this should be the same as Pow.as_numer_denom wrt
         # exponent handling
+        if not self.is_commutative:
+            return self, S.One
         exp = self.exp
         neg_exp = exp.is_negative
         if not neg_exp and not (-exp).is_negative:


Test patch:
diff --git a/sympy/functions/elementary/tests/test_exponential.py b/sympy/functions/elementary/tests/test_exponential.py
index 82c071c64d..def3eaad26 100644
--- a/sympy/functions/elementary/tests/test_exponential.py
+++ b/sympy/functions/elementary/tests/test_exponential.py
@@ -686,6 +686,9 @@ def test_as_numer_denom():
     assert exp(-I*x).as_numer_denom() == (1, exp(I*x))
     assert exp(-I*n).as_numer_denom() == (1, exp(I*n))
     assert exp(-n).as_numer_denom() == (exp(-n), 1)
+    # Check noncommutativity
+    a = symbols('a', commutative=False)
+    assert exp(-a).as_numer_denom() == (exp(-a), 1)
 
 
 @_both_exp_pow