<jupyter_start><jupyter_text>Compare satvpw(T) with the idealized saturation vapor pressure function for based on a constant latent heat of vaporization, using the triple point temperature and pressure as the base values.<jupyter_code>T_values=np.linspace(200,320,100)
satvpw_values=np.array(satvpw(T_values))
idealized_values=np.array(satvp1(T_values))
plt.plot(T_values,satvpw_values,label='sat_vpw')
plt.plot(T_values,idealized_values,label='idealized')
plt.yscale('log')
plt.legend()
plt.xlabel('Temperature (K)')
plt.ylabel('Vapor Pressure (Pa)')
plt.show()
error=(idealized_values-satvpw_values)/satvpw_values
plt.plot(T_values,error)
plt.xlabel('Temperature (K)')
plt.ylabel('Residual in Vapor Pressure (Pa)')
plt.show()<jupyter_output><empty_output><jupyter_text>The idealized function which assumes constant latent heat overestimates the vapor pressure at low temperatures.  Try using the boiling point pressure and temperature as the reference value for satvp1 and see how the comparison differs.<jupyter_code>#Changing reference values for satvp1 to boiling point
T0=373.15 #K
psat0=100000 #Pascals
idealized_values=np.array(satvp1(T_values))
plt.plot(T_values,satvpw_values,label='sat_vpw')
plt.plot(T_values,idealized_values,label='idealized')
plt.yscale('log')
plt.legend()
plt.xlabel('Temperature (K)')
plt.ylabel('Vapor Pressure (Pa)')
plt.show()
error=(idealized_values-satvpw_values)/satvpw_values
plt.plot(T_values,error)
plt.xlabel('Temperature (K)')
plt.ylabel('Residual in Vapor Pressure (Pa)')
plt.show()<jupyter_output><empty_output><jupyter_text>The idealized function with the boiling point as reference values underestimates the vapor pressure at higher temperatures. It appears that the error is closer to zero over a wider range of temperatures with the triple point as reference values.  Compare the empirical and idealized vapor pressures for ice in the range 150K to 273K.<jupyter_code>#Changing LdivR_A for latent heat of sublimation
T0=273.16 #K
psat0=611.657 #Pascals
LdivR_A = 2260/0.46152
print(LdivR_A)
T_values=np.linspace(150,273,100)
satvpi_values=np.array(satvpi(T_values))
idealized_values=np.array(satvp1(T_values))
plt.plot(T_values,satvpi_values,label='sat_vpi')
plt.plot(T_values,idealized_values,label='idealized')
plt.yscale('log')
plt.legend()
plt.xlabel('Temperature (K)')
plt.ylabel('Vapor Pressure (Pa)')
plt.show()
error=(idealized_values-satvpi_values)/satvpi_values
plt.plot(T_values,error)
plt.xlabel('Temperature (K)')
plt.ylabel('Residual in Vapor Pressure (Pa)')
plt.show()<jupyter_output><empty_output><jupyter_text>The idealized function for vapor pressure over ice underestimates at all temperatures.  Compare satvpw(T) with a simplified function consisting of the constant L function for ice below the triple point and the constant L function for liquid water above the triple point.<jupyter_code>T0=273.16 #K
psat0=611.657 #Pascals
def satvp1(T):
    if T<273.16:
        LdivR_A = 2260/0.46152
    if T>273.16:
        LdivR_A = 5420
    return psat0*np.exp((-LdivR_A)*((1/T)-(1/T0)))
T_values=np.linspace(250,290,100)
satvpw_values=np.array(satvpw(T_values))
idealized_values=np.array([satvp1(T_values[i]) for i in range(len(T_values))])
plt.plot(T_values,satvpw_values,label='sat_vpw')
plt.plot(T_values,idealized_values,label='idealized')
plt.yscale('log')
plt.legend()
plt.xlabel('Temperature (K)')
plt.ylabel('Vapor Pressure (Pa)')
plt.show()
error=(idealized_values-satvpw_values)/satvpw_values
plt.plot(T_values,error)
plt.xlabel('Temperature (K)')
plt.ylabel('Residual in Vapor Pressure (Pa)')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12111973392461198, 'fraction_numerical': 0.03242793791574279, 'mean_word_length': 7.823960880195599, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '182819', 'license': 'MIT', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1281, 'n_words': 289, 'path': 'notebooks/ch02/Problem.2.39.ipynb', 'repo_name': 'BrownDwarf/purplebook', 'size': '3608'}