I'm using Python 3 to use scipy's integrate.quad() function to integrate the expression (t^s / cosh^2(t)) for a given input s. I get the OverflowError: math range error.
My code looks like this:
from math import inf
from math import cosh
from scipy.integrate import quad
import numpy as np
def Integral_Expression(s):
ans, err = quad(lambda t: (np.power(t,s))/(np.power(cosh(t),2)), 0, inf)
return ans
I've seen other people who get the Math Range Error use numpy's exp() or power() methods to solve the problem, but it doesn't seem to be working. I also tried
and, err = decimal.Decimal(quad(lambda t: (power(t,s))/power(cosh(t),2), 0, inf))
with no success. Thanks for any help!
sdo you consider?