I got a strange problem. The code to reproduce the problem is given below
from scipy.constants import h, c, k
def T2(x):
a=11717 # To match T(1AU)=680K*0.7
if x < 21500 : return a*(x**-0.53)
else :
print(x) # Just for debugging
return a*(x**-0.75)
# Blackbody Planky function
def B(Lambda,Temp):
return 2*h*c**2/(Lambda**5 *(exp(h*c/(Lambda*k*Temp))-1))
def flux2(Lambda):
return numerical_integral(2*pi*x*B(Lambda,T2(x)),7,2150)[0]
print 2.5*log(flux2(9000*10**-10))
The problem is inside the T2() function. Since the integral in x is from 7 to 2150, The if condition should get satisfied. and return the a(x*-0.53) . But instead it is evaluating the else condition. print x is printing the alphabet 'x' instead of the value of variable x it is supposed to take during each point in integral. I guess i have understood how these functions work inside an integral wrongly. What is it that I am doing wrong here?