I'm working with a function that's something like (after evaluating the constants):

```
def n(x):
    return (1.416e-28)*(x**47)*(np.exp(-4.545*x))

```

X ranges from 0 to 20. The x^47 term in the middle causes problems; even though the first and last terms get very small as x increases, the code overflows at x^47.

I've been able to get it to work by making the following modification:

```
def n(x):
    logn=math.log((1.416e-28)*(x**47)*(np.exp(-4.545*x)),x)
    return np.pow(r,logn)

```

This returns quite manageable numbers.

The problem is I'm trying to pass in a numpy array, but math.log only accepts scalars. Furthermore, numpy doesn't seem to have a log function that accepts an arbitrary base. Evidently the only way to do this in numpy is to do something like:

```
np.log(42**3)/np.log(42)

```

But it can't handle the large number in the first place without FIRST taking the log at base r. So numpy won't work.

Should I just be un-pythonic and iterate through the n(x) fcn?