Hi, I’m trying to do some numerical simulation and I wanted to try out Numba to speed up my code.

I’ve to do several for loops and I use only numpy, thus I think that @jit should work well.

I cannot post all the code because it is extremely long but this is one simple functions that is giving me issues (and its error). C&R are two matrices that contains values of order 1.

Can anyone give a check and see if there is an error that I didn’t see?

I don’t understand how that calculation can lead to an overflow…

Error:

```
<ipython-input-11-c859736ae262>:6: RuntimeWarning: overflow encountered in multiply
temp3 += dt * np.sum(fun2(C[t][0:t], 3) * R[t][0:t] * C[t][0:t])
<ipython-input-3-05212490067d>:6: RuntimeWarning: overflow encountered in double_scalars
temp = -mu[t] * C[t][t1]
<ipython-input-3-05212490067d>:8: RuntimeWarning: overflow encountered in multiply
temp3 += dt * np.sum(fun2(C[t][0:t], 3) * R[t][0:t] * (np.transpose(C))[t1][0:t])
<ipython-input-3-05212490067d>:13: RuntimeWarning: invalid value encountered in double_scalars
return temp + temp3 + temp4;
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py:87: RuntimeWarning: invalid value encountered in reduce
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
```

And here is the code:

```
@njit
def fun1(q, d): # fun1 = first derivative, fun2 = second derivative
return 0.5 * d * q**(d-1)
@njit
def evol_R(t, t1):
temp = 0; temp3 = 0; temp4 = 0;
temp += - mu[t]*R[t][t1]
temp3 += dt * np.sum(fun2(C[t][t1:t], 3) * R[t][t1:t] * (np.transpose(R))[t1][t1:t])
temp4 += dt * np.sum(fun2(C[t][t1:t], 4) * R[t][t1:t] * (np.transpose(R))[t1][t1:t])
return temp + temp3 + temp4
```