RuntimeWarning: invalid value encountered in double_scalars – without numpy

The error is simply used to indicate a division where the denominator is of 0 value, e.g. your data somehow contains incorrect values, for example you try to take the square root of negative numbers, or 1/a where a (which is an array) contains zeroes.

RuntimeWarning: divide by zero encountered in double_scalars

I am not able to reproduce the same error from the code above, just like you mentioned so it’s a bit hard for me to debug the exact problem.

My advice would be to debug your main code, stepping through line by line and understand the numerical operations that are taking place. You will then be able to tell at exactly where this occurs.

Leave a Comment

tech