I'm trying to evaluate the exponential of a symbolic array. Basically I have a numeric array a
and a symbolic variable x
defined. I then defined a function f
which is equal to the exponential of the multiplication of the two, and tried to evaluate the result for a given value of x
:
import numpy as np
from sympy import *
#Declaration of variables
a=np.array([1, 2])
x = Symbol('x')
f=exp(a*x)
#Function evaluation
f=f.subs(x, 1)
print(f.evalf())
But the following error happens:
AttributeError: 'ImmutableDenseNDimArray' object has no attribute '_eval_evalf'
It seems that exp()
function isn't prepared for this type of operations.
I know, at least, that it is possible to compute the exponential of a numeric array using np.exp()
. How should I do it for the case of a symbolic array?