# Variables
t_c = 303-273; # in °C
# Calculations and Results
t_f = 9./5* t_c+32; # in °F
print "When the temperature is 303 K then the thermometer reading in °F is : %.0f"%t_f
T_R = 460 + t_f; # °R
print "The absolute value of the temperature in Rankine scale in °R is : %.0f"%T_R
# Variables
# t_C= t_F or T_K-T_R= -186.52 (i)
# T_R/T_K = 1.68 (ii)
# From eq (i) and (ii)
T_K= -186.52/(1-1.68); # temp. in kelvin in K
# Calculations
T_R= 1.68*T_K; # in temp. in rankine in °R
t_C= T_K-273.15; # in °C
t_F= T_R-459.67; # in °F
# Results
print "Temperature in kelvin is : %.2f"%T_K
print "Temperature in °R is : %.2f"%T_R
print "Temperature in °C is : %.2f"%t_C
print "Temperature in °F is : %.2f"%t_F
import math
# Variables
p0 = 1.86;
p100 = 6.81;
T1=32;
T2= 212;
# Calculations
# Relation of T in terms of p for ice point T1= a*math.log(p0)+b (i)
# Relation of T in terms of p for steam point T2= a*math.log(p100)+b (ii)
# From eq(i) and (ii)
a= (T2-T1)/math.log(p100/p0);
b= T1-a*math.log(p0);
# The temp at
p=2.5;
T= a*math.log(p)+b; # in °unit
# Results
print "The temperature at p=2.5 in °unit is : %.3f"%T
from numpy import roots
# Variables
Tp0=0.; #in °C (at ice point)
Tq0=0.; #in °C (at ice point)
# Putting these values in relation, we get
a=0.;
Tp100=100.; #in °C ( at steam point)
Tq100=100.; #in °C ( at steam point)
# Tp100= b*Tq100+lamda*Tq100**2 (i)
Tp=45.; # in °C (in oil path)
Tq=43.; # in °C (in oil path)
# Calculations
# Tp= b*Tq+lamda*Tq**2 (ii)
b= (Tp100-Tp*Tq100**2/Tq**2)/(Tq100-Tq100**2/Tq); # From eq (i) and (ii)
lamda= (Tp-b*Tq)/Tq**2;
Tp=20;
#lamda*Tq**2+b*Tq-Tp=0
P= [lamda, b, -Tp];
Tq= roots(P); # in °C
# Results
print "When P reads 20°C, then the readings of Q in °C are %.2f C "%(Tq[1])
print "The realistic value of Tq in °C is : %.2f"%Tq[1]