Repository: sympy/sympy

Issue:
exp of MatrixSymbol throws an error
```
>>> A = MatrixSymbol("A", 2, 2)
>>> exp(A)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/sympy/sympy/core/function.py", line 441, in __new__
    result = super(Function, cls).__new__(cls, *args, **options)
  File "/home/ubuntu/sympy/sympy/core/function.py", line 250, in __new__
    evaluated = cls.eval(*args)
  File "/home/ubuntu/sympy/sympy/functions/elementary/exponential.py", line 305, in eval
    return arg.exp()
AttributeError: 'MatrixSymbol' object has no attribute 'exp'
```

Other functions, like sin(A) or cos(A), return the expected expressions.

Discussion:

Patch:
diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py
index f1b9a86c3d..b7fed5c2c9 100644
--- a/sympy/functions/elementary/exponential.py
+++ b/sympy/functions/elementary/exponential.py
@@ -230,6 +230,7 @@ def eval(cls, arg):
         from sympy.assumptions import ask, Q
         from sympy.calculus import AccumBounds
         from sympy.sets.setexpr import SetExpr
+        from sympy.matrices.matrices import MatrixBase
         if arg.is_Number:
             if arg is S.NaN:
                 return S.NaN
@@ -301,7 +302,7 @@ def eval(cls, arg):
             if out:
                 return Mul(*out)*cls(Add(*add), evaluate=False)
 
-        elif arg.is_Matrix:
+        elif isinstance(arg, MatrixBase):
             return arg.exp()
 
     @property


Test patch:
diff --git a/sympy/functions/elementary/tests/test_exponential.py b/sympy/functions/elementary/tests/test_exponential.py
index cd101a7454..8817afd95c 100644
--- a/sympy/functions/elementary/tests/test_exponential.py
+++ b/sympy/functions/elementary/tests/test_exponential.py
@@ -2,7 +2,7 @@
     symbols, log, ln, Float, nan, oo, zoo, I, pi, E, exp, Symbol,
     LambertW, sqrt, Rational, expand_log, S, sign, conjugate, refine,
     sin, cos, sinh, cosh, tanh, exp_polar, re, Function, simplify,
-    AccumBounds)
+    AccumBounds, MatrixSymbol)
 from sympy.abc import x, y, z
 
 
@@ -127,6 +127,11 @@ def test_exp_taylor_term():
     assert exp(x).taylor_term(4, x) == x**4/24
 
 
+def test_exp_MatrixSymbol():
+    A = MatrixSymbol("A", 2, 2)
+    assert exp(A).has(exp)
+
+
 def test_log_values():
     assert log(nan) == nan