# Exercise 3.23
from math import log, pi
def egg(M, T0=20, Ty=70):
rho = 1.038
K = 5.4e-3
c = 3.7
Tw = 100
t = M**(2.0/3) * c * rho**(1.0/3) / (K * pi**2 * ((4*pi)/3)**(2.0/3)) * log(0.76*(T0-Tw)/(Ty-Tw))
return t
# For a soft boiled egg, the yolk temperature (Ty) should not exceed 70,
# while for a hard boiled egg, the yolk temperature should be allowed to
# reach 70. This is according to Exercise 1.12 on page 46. So how should
# we set Ty? Here we use Ty=65 for soft boiled egg and Ty=80 for hard
# boiled egg.
# Soft boiled, small, from fridge:
print(egg(47, T0=4, Ty=65))/60
# Soft boiled, large, from fridge:
print(egg(67, T0=4, Ty=65))/60
# Soft boiled, small, from hot room:
print(egg(47, T0=25, Ty=65))/60
# Soft boiled, large, from hot room:
print(egg(67, T0=25, Ty=65))/60
# Hard boiled, small, from fridge:
print(egg(47, T0=4, Ty=80))/60
# Hard boiled, large, from fridge:
print(egg(67, T0=4, Ty=80))/60
# Hard boiled, small, from hot room:
print(egg(47, T0=25, Ty=80))/60
# Hard boiled, large, from hot room:
print(egg(67, T0=25, Ty=80))/60