Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When calling T2(x) inside the function flux2 x is an element of Symbolic Ring and bool(x < 21500) gives False.

The range 7 to 2150 doesn't matter because T2(x) is evaluated before any substitution of x happens.

You can get the desired behavior with an assumption ( try with and without forget() )

#print assumptions()
from scipy.constants import h, c, k
def T2(x):
    if x < 21500 : 
        return a*(x**-0.53)
    else :
        print(x.parent())  # 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))