# evaluvating variable inside a function while integrating

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
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?

**Update:** I instead tried the Piecewise() function to define T2() as follows,

```
a=11717
T2= Piecewise([[(0,215),a*(x**-0.53)],[(215,21500),a*(x**-0.75)]])
```

but inside the integral function I am getting ValueError

ValueError: Value not defined outside of domain.