import math
d = 1 # Assumption
l = 1 # Assumption
A_ACDB = (math.pi/4)*(1/3.0)*((1.05*d)**2)*10.5*l - (math.pi/4)*(1/3.0)*d**2*10*l # Area of ABCD
A_AEFB = (math.pi/4)*(1/3.0)*((1.1*d)**2)*11*l - (math.pi/4)*(1/3.0)*d**2*10*l # Area of AEFB
t = 100*(A_ACDB/A_AEFB)
print "\n Example 2.1"
print "\n The straight bore thermometer reading will be ",round(t,2)," degree Celsius."
#The answers vary due to round off error
import math
import numpy.polynomial.polynomial
#t = numpy.polynomial(0,'t')
def f1(t):
e=(0.2*t)-((5e-4)*t**2)
return e# e.m.f. as a function of temperature in mV
e0 = f1(0)#horner(e, 0) # e.m.f. at t = 0 degree
e100 = f1(100) # e.m.f. at t = 100 degree
e50 = f1(50) # e.m.f. at t = 50 degree
r = (100/e100)*e50 # Reading of thermocouple at t = 50degree
print "\n Example 2.2"
print "\n Reading of thermocouple at t = 50 degree Celsius will be ",round(r,2)," degree Celsius."
#The answers vary due to round off error