diff options
Diffstat (limited to 'Thermodynamics_by_K._M._Gupta/ch3.ipynb')
-rw-r--r-- | Thermodynamics_by_K._M._Gupta/ch3.ipynb | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/Thermodynamics_by_K._M._Gupta/ch3.ipynb b/Thermodynamics_by_K._M._Gupta/ch3.ipynb new file mode 100644 index 00000000..6e8007f9 --- /dev/null +++ b/Thermodynamics_by_K._M._Gupta/ch3.ipynb @@ -0,0 +1,212 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 : Zeroth Law of Thermodynamics and Temperature Scales" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1 Page No : 72" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "When the temperature is 303 K then the thermometer reading in °F is : 86\n", + "The absolute value of the temperature in Rankine scale in °R is : 546\n" + ] + } + ], + "source": [ + "\n", + "# Variables\t\t\t\n", + "t_c = 303-273;\t\t\t# in °C\n", + "\n", + "# Calculations and Results\n", + "t_f = 9./5* t_c+32;\t\t\t# in °F\n", + "print \"When the temperature is 303 K then the thermometer reading in °F is : %.0f\"%t_f\n", + "\n", + "T_R = 460 + t_f;\t\t\t# °R\n", + "print \"The absolute value of the temperature in Rankine scale in °R is : %.0f\"%T_R\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.2 Page No : 73" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature in kelvin is : 274.29\n", + "Temperature in °R is : 460.81\n", + "Temperature in °C is : 1.14\n", + "Temperature in °F is : 1.14\n" + ] + } + ], + "source": [ + "\n", + "\n", + "# Variables\n", + "# t_C= t_F or T_K-T_R= -186.52 (i)\n", + "# T_R/T_K = 1.68 (ii)\n", + "# From eq (i) and (ii)\n", + "T_K= -186.52/(1-1.68);\t\t\t# temp. in kelvin in K\n", + "\n", + "# Calculations\n", + "T_R= 1.68*T_K;\t\t\t # in temp. in rankine in °R\n", + "t_C= T_K-273.15;\t\t\t# in °C\n", + "t_F= T_R-459.67;\t\t\t# in °F\n", + "\n", + "# Results\n", + "print \"Temperature in kelvin is : %.2f\"%T_K\n", + "print \"Temperature in °R is : %.2f\"%T_R\n", + "print \"Temperature in °C is : %.2f\"%t_C\n", + "print \"Temperature in °F is : %.2f\"%t_F\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.9 Page No : 75" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The temperature at p=2.5 in °unit is : 73.014\n" + ] + } + ], + "source": [ + "import math \n", + "\n", + "# Variables\n", + "p0 = 1.86;\n", + "p100 = 6.81;\n", + "T1=32;\n", + "T2= 212;\n", + "\n", + "# Calculations\n", + "# Relation of T in terms of p for ice point T1= a*math.log(p0)+b (i)\n", + "# Relation of T in terms of p for steam point T2= a*math.log(p100)+b (ii)\n", + "# From eq(i) and (ii)\n", + "a= (T2-T1)/math.log(p100/p0);\n", + "b= T1-a*math.log(p0);\n", + "# The temp at \n", + "p=2.5;\n", + "T= a*math.log(p)+b;\t\t\t# in °unit\n", + "\n", + "# Results\n", + "print \"The temperature at p=2.5 in °unit is : %.3f\"%T\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.10 Page No : 76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "When P reads 20°C, then the readings of Q in °C are 18.76 C \n", + "The realistic value of Tq in °C is : 18.76\n" + ] + } + ], + "source": [ + "\n", + "from numpy import roots\n", + "\n", + "# Variables\t\t\t\n", + "Tp0=0.;\t\t\t#in °C (at ice point)\n", + "Tq0=0.;\t\t\t#in °C (at ice point)\n", + " # Putting these values in relation, we get\n", + "a=0.;\n", + "Tp100=100.;\t\t\t#in °C ( at steam point)\n", + "Tq100=100.;\t\t\t#in °C ( at steam point)\n", + " # Tp100= b*Tq100+lamda*Tq100**2 (i)\n", + "Tp=45.;\t\t\t# in °C (in oil path)\n", + "Tq=43.;\t\t\t# in °C (in oil path)\n", + "\n", + "# Calculations\n", + "# Tp= b*Tq+lamda*Tq**2 (ii)\n", + "b= (Tp100-Tp*Tq100**2/Tq**2)/(Tq100-Tq100**2/Tq);\t\t\t# From eq (i) and (ii)\n", + "lamda= (Tp-b*Tq)/Tq**2;\n", + "Tp=20;\n", + "\n", + "#lamda*Tq**2+b*Tq-Tp=0\n", + "P= [lamda, b, -Tp];\n", + "Tq= roots(P);\t\t\t# in °C\n", + "\n", + "# Results\n", + "print \"When P reads 20°C, then the readings of Q in °C are %.2f C \"%(Tq[1])\n", + "print \"The realistic value of Tq in °C is : %.2f\"%Tq[1]\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |