1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
{
"metadata": {
"name": "",
"signature": "sha256:1c6a10e6b876d2730bb167805af2fccb3104db62a9988f5aa3ef9c4c86e9b481"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 2: Zeroth Law of Thermodynamics"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1, page no. 46"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"#Variable Declaration: \n",
"Tf = 98.6 #Temperature of human body in degree Fahrenheit:\n",
"\n",
"#Calculation:\n",
"Tc = (Tf-32)/1.8 #Temperature of the body in degree Celcius:\n",
"\n",
"#Results:\n",
"print \"Temperature of the human body \",Tc,\"\u00b0C\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Temperature of the human body 37.0 \u00b0C\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2, page no. 47"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"import math as m\n",
"import numpy as n\n",
"\n",
"#Variable Declaration: \n",
"p0 = 3.0 #Thermodynamic property at T = 0:\n",
"p100 = 8.0 #Thermodynamic property at T = 100:\n",
"p = 6.5 #Thermodynamic property at which t is to be found\n",
"\n",
"#Calculation:\n",
"#Solving two linear equation by linear Algebra using matrices AX = B\n",
"A = n.matrix([[m.log(p0),0.5],[m.log(p100),0.5]])\n",
"B = n.matrix([[0],[100]])\n",
"X = n.matrix.getI(A)*B\n",
"a = round(X[0],2) #Thermodynamic constant a from matrix solution\n",
"b = round(X[1]) #Thermodynamic constant b from matrix solution\n",
"t = a*m.log(p)-b/2 #At thermodynamic property p = 6.5:\n",
"\n",
"#Results:\n",
"print \"Temperature at the value of thermodynamic property (p = 6.5)\" ,round(t,2),\"\u00b0C\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Temperature at the value of thermodynamic property (p = 6.5) 302.83 \u00b0C\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3, page no. 47"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"#Variable Declaration:\n",
"T0 = 0 #Ice point (\u00b0C)\n",
"T100 = 100 #Steam Poiont (\u00b0C)\n",
"def E(t): #Function definition for above expression of EMF\n",
" return 0.003*t - 5*10**-7*t**2 + 0.5 *10**-3\n",
"\n",
"#Calculation:\n",
"t = (E(30)-E(0))/(E(100)-E(0))*(T100-T0) #Temperature shown by the thermometer at T = 30:\n",
"\n",
"#Results:\n",
"print \"!--Please check that there are calculation mistake done in the book \\nhence there is heavy difference in answer of book and the code--!\\n\"\n",
"print \"The temperature shown by thermometer: \",round(t,2),\"\u00b0C\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"!--Please check that there are calculation mistake done in the book \n",
"hence there is heavy difference in answer of book and the code--!\n",
"\n",
"The temperature shown by thermometer: 30.36 \u00b0C\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4, page no. 48"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"#Variable Declaration: \n",
"t1 = 50 #Temperature of gas using gas thermometer:\n",
"def E(t): #Function Definition as per question:\n",
" return 0.18*t - 5.2*10**-4*t**2\n",
" \n",
"#Calculation:\n",
"t = (100-0)*E(t1)/(E(100)-E(0))\t#Temperature at EMF = E50:\n",
"p = (t-t1)/t1*100\n",
"\n",
"#Results:\n",
"print \"Percentage variation: \",round(p,2),\"%\"\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Percentage variation: 20.31 %\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5, page no. 48"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"import numpy as n\n",
"\n",
"#Variable Declaration: \n",
"#Solving the conversion relation X = aC + b using matrices and finding a and b\n",
"B = n.matrix([[0],[1000]])\n",
"A = n.matrix([[0,1],[100,1]])\n",
"\n",
"#Calculations:\n",
"X = n.matrix.getI(A)*B\n",
"a = round(X[0]) #Value of a of equation X = aC + B\n",
"b = round(X[1]) #Value of b of equation X = aC + B\n",
"X = a*-273.15+b #Absolute temperature in new temperature scale:\n",
"\n",
"#Results:\n",
"print \"Absolute temperature in new scale: \",X,\"\u00b0X\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Absolute temperature in new scale: -2731.5 \u00b0X\n"
]
}
],
"prompt_number": 5
}
],
"metadata": {}
}
]
}
|