PDistl
PDistl

Reputation: 47

Numpy exp() not callable

If I use 2 np arrays as x,y input into the following expression...

out = np.exp(3(x-4)-0.0001*y)

...I get "TypeError: 'int' object is not callable

If I use the same as function and call this function with a curve fit I get a similiar error:

def func(X, a, b):
    x,y = X
    return np.exp(a(x-4)-b*y)

Here I get:'numpy.float64' object is not callable

What am I doing wrong? It's working with others type of functions that don't use exp.

Upvotes: 0

Views: 522

Answers (1)

berkeebal
berkeebal

Reputation: 493

out = np.exp(3(x-4)-0.0001*y)

The problem in this expression is that the np.exp() function takes one argument but you passed 2. I don't know this is the best solution but instead of this you can try:

operations = 3*(x-4) - (0.0001*y)
out = np.exp(operations)

Upvotes: 1

Related Questions