[Tutor] How to solve the overflow error in double_scalars

SATYABRATA DATTA iamsatyabrata428 at gmail.com
Thu Apr 28 14:48:17 EDT 2022


Inside a python package Encountering overflow due to a part of code

this is my code part

    def V1(self, bosons, fermions, X):
        X = np.asanyarray(X, dtype=np.float64)
        phi1 = X[...,0]

        y1 = (17/3)*(4*(self.y6**4) - 3*(self.g**4))*(phi1**4)

        y1 -= (4*(self.y6**4) -
3*(self.g**4))*(2*np.log(np.abs((phi1)/(self.renormScaleSq**0.5))+
1e-100))*(phi1**4)
        return (y1/(64*np.pi*np.pi))

The error message is

Warning (from warnings module):
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\cosmoTransitions\gen_poten.py",
line 258
    y1 -= (4*(self.y6**4) -
3*(self.g**4))*(2*np.log(np.abs((phi1)/(self.renormScaleSq**0.5))+
1e-100))*(phi1**4)RuntimeWarning: overflow encountered in
double_scalars
Warning (from warnings module):
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\cosmoTransitions\gen_poten.py",
line 258
    y1 -= (4*(self.y6**4) -
3*(self.g**4))*(2*np.log(np.abs((phi1)/(self.renormScaleSq**0.5))+
1e-100))*(phi1**4)RuntimeWarning: overflow encountered in multiply


and getting a completely wrong output,I think it is occuring due to the log
function but don't know how to resolve it


More information about the Tutor mailing list