#cal of temperature of body of human
#intiation of all variables
# Chapter 2
print"Example 2.1, Page:46 \n \n"
print("Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 1")
Tf=98.6;#temperature of body in farenheit
Tc=(Tf-32)/1.8
print("degree celcius and farenheit are related as follows")
print("Tc=(Tf-32)/1.8")
print("so temperature of body in degree celcius"),round(Tc,2)
#cal of celcius temperature
#intiation of all variables
# Chapter 2
import math
print"Example 2.2, Page:47 \n \n"
print("Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 2")
t1=0;#ice point temperature in degree celcius
p1=3;#thermometric property for ice point
t2=100;#steam point temperature in degree celcius
p2=8;#thermometric property for steam point
p3=6.5;#thermometric property for any temperature
print("using thermometric relation")
print("t=a*log(p)+(b/2)")
print("for ice point,b/a=")
b=2*math.log(p1)
print("so b=2.1972*a")
print("for steam point")
a=t2/(math.log(p2)-(2.1972/2))
print("a="),round(a,2)
b=2.1972*a
print("and b="),round(b,2)
t=a*math.log(p3)+(b/2)
print("thus, t=in degree celcius")
print("so for thermodynamic property of 6.5,t=302.83 degree celcius="),round(t,2)
#cal of temperature shown by this thermometer
#intiation of all variables
# Chapter 2
print"Example 2.3, Page:47 \n \n"
print("Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 3")
print("emf equation")
print("E=(0.003*t)-((5*10^-7)*t^2))+(0.5*10^-3)")
print("using emf equation at ice point,E_0 in volts")
t=0.;#ice point temperature in degree celcius
E_0=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)
print("E_0="),round(E_0,2)
print("using emf equation at steam point,E_100 in volts")
t=100.;#steam point temperature in degree celcius
E_100=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)
print("E_100="),round(E_100,2)
print("now emf at 30 degree celcius using emf equation(E_30)in volts")
t=30.;#temperature of substance in degree celcius
E_30=(0.003*t)-((5.*10**-7)*t**2)+(0.5*10**-3)
T_100=100.;#steam point temperature in degree celcius
T_0=0.;#ice point temperature in degree celcius
T=((E_30-E_0)/(E_100-E_0))*(T_100-T_0)
print("now the temperature(T) shown by this thermometer")
print("T=in degree celcius"),round(T,2)
print("NOTE=>In this question,values of emf at 100 and 30 degree celcius is calculated wrong in book so it is corrected above so the answers may vary.")
#cal of percentage variation in temperature
#intiation of all variables
# Chapter 2
import math
print"Example 2.4, Page:48 \n \n"
print("Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 4")
t1=0;#temperature at ice point
t2=100;#temperature at steam point
t3=50;#temperature of gas
print("emf equation,e=0.18*t-5.2*10^-4*t^2 in millivolts")
print("as ice point and steam points are two reference points,so")
print("at ice point,emf(e1)in mV")
e1=0.18*t1-5.2*10**-4*t1**2
print("at steam point,emf(e2)in mV")
e2=0.18*t2-5.2*10**-4*t2**2
print("at gas temperature,emf(e3)in mV")
e3=0.18*t3-5.2*10**-4*t3**2
t=((t2-t1)/(e2-e1))*e3
variation=((t-t3)/t3)*100
print("since emf variation is linear so,temperature(t)in degree celcius at emf of 7.7 mV"),round(t,2)
print("temperature of gas using thermocouple=60.16 degree celcius")
print("percentage variation=((t-t3)/t3)*100variation in temperature reading with respect to gas thermometer reading of 50 degree celcius"),round(variation,2)
#cal of absolute zero temperature
#intiation of all variables
# Chapter 2
print"Example 2.5, Page:48 \n \n"
print("Engineering Thermodynamics by Onkar Singh,Chapter 2,Example 5")
print("let the conversion relation be X=aC+b")
print("where C is temperature in degree celcius,a&b are constants and X is temperature in X degree ")
print("at freezing point,temperature=0 degree celcius,0 degree X")
print("so by equation X=aC+b")
X=0;#temperature in degree X
C=0;#temperature in degree celcius
print("we get b=0")
b=0;
print("at boiling point,temperature=100 degree celcius,1000 degree X")
X=1000;#temperature in degree X
C=100;#temperature in degree celcius
a=(X-b)/C
print("conversion relation")
print("X=10*C")
print("absolute zero temperature in degree celcius=-273.15")
X=10*-273.15
print("absolute zero temperature in degree X="),round(X,2)