summaryrefslogtreecommitdiff
path: root/Chemistry_by_Raymond_Chang/Chapter_14.ipynb
blob: 29fa23a91cced5b7851c762a3b4ab1e76e926796 (plain)
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14:Chemical Equilibrium"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.2,Page no:622"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "NO=0.0542 #equilibrium conc of NO, M\n",
      "O2=0.127 #equilibrium conc of O2, M\n",
      "NO2=15.5 #equilibrium conc of NO2, M\n",
      "\n",
      "#Calculation\n",
      "Kc=NO2**2/(O2*NO**2) #equilibrium constant for given reaction\n",
      "\n",
      "#Result\n",
      "print\"The value of the equilibrium constant of the reaction is %.2e\"%Kc\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of the equilibrium constant of the reaction is 6.44e+05\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.3,Page no:623"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "PCl3=0.463 #equilibrium pressure of PCl3, atm\n",
      "PCl5=0.875 #equilibrium pressure of PCl5, atm\n",
      "Kp=1.05 #equilibrium constant of the reaction\n",
      "\n",
      "#Calculation\n",
      "Cl2=Kp*PCl5/PCl3 #equilibrium pressure of Cl2 in atm, formula from the definition of equilibrium constant\n",
      "\n",
      "#Result\n",
      "print\"The value of the equilibrium pressure of the Cl2 gas is :\",round(Cl2,2),\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of the equilibrium pressure of the Cl2 gas is : 1.98 atm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.4,Page no:623"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Kc=10.5 \n",
      "delta_n=1-3 \n",
      "T=273+220 \n",
      "\n",
      "#Calculation\n",
      "Kp=Kc*(0.0821*T)**delta_n \n",
      "\n",
      "#Result\n",
      "print\"The value of the equilibrium constant of the reaction is :%.2e\"%Kp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of the equilibrium constant of the reaction is :6.41e-03\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.6,Page no:626"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "CO2=0.236 #pressure of CO2 gas, atm\n",
      "T=273+800 \n",
      "\n",
      "#Calculation\n",
      "#(a)\n",
      "Kp=CO2 \n",
      "#(b)\n",
      "delta_n=1 \n",
      "Kc=Kp*(0.0821*T)**-delta_n \n",
      "\n",
      "#Result\n",
      "print\"(a) the value of Kp of the reaction is :\",Kp\n",
      "print\"(b) the value of Kc of the reaction is %.2e\"%Kc"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) the value of Kp of the reaction is : 0.236\n",
        "(b) the value of Kc of the reaction is 2.68e-03\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.8,Page no:633"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Kc=1.2 #equilibrium constant for the reaction\n",
      "N2=.249/3.5 #conc of N2, M\n",
      "H2=(3.21*10**-2)/3.5 #conc of H2, M\n",
      "NH3=(6.42*10**-4)/3.5 #conc of NH3, M\n",
      "\n",
      "#Calculation\n",
      "Qc=NH3**2/(N2*H2**3) #reaction quotient initial\n",
      "print\"Qc=\",round(Qc,3),\"(approx)\"\n",
      "\n",
      "#Result\n",
      "if(Qc==Kc):\n",
      "    d=\"the system is in equilibrium\" \n",
      "elif(Qc<Kc):\n",
      "    d=\"the system is not in equilibrium and the reaction will move from left to right\" \n",
      "else:\n",
      "    d=\"the system is not in equilibrium and the reaction will move from right to left\" \n",
      "print d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Qc= 0.613 (approx)\n",
        "the system is not in equilibrium and the reaction will move from left to right\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.9,Page no:635"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Kc=54.3 \n",
      "H2i=0.5 #initial moles of H2\n",
      "I2i=0.5 #initial moles of I2\n",
      "\n",
      "#Calculation\n",
      "#Let us assume that x moles have reacted, so, HI=2x, H2=0.5-x, I2=0.5-x, when we substitute in Kc=(HI)**2/(H2)*(I2) we get 54.3=(2x)**2/((0.5-x)*(0.5-x)) taking root we get 7.37=2*x/0.5-x\n",
      "x=0.393 #from the above equation\n",
      "H2=0.5-x \n",
      "I2=0.5-x \n",
      "HI=2*x \n",
      "\n",
      "#Result\n",
      "print\"The equilibrium concentration of H2 is :\",H2,\"M\" \n",
      "print\"The equilibrium concentration of I2 is :\",I2,\"M\"\n",
      "print\"The equilibrium concentration of HI is :\",HI,\"M\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium concentration of H2 is : 0.107 M\n",
        "The equilibrium concentration of I2 is : 0.107 M\n",
        "The equilibrium concentration of HI is : 0.786 M\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.10,Page no:636"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable declaration\n",
      "Kc=54.3 \n",
      "HIo=0.0224 \n",
      "H2o=0.00623 \n",
      "I2o=0.00414 \n",
      "#let us assume that x moles have reacted, so, HI=HIo+2x, H2=0.00623-x, I2=0.00414-x, when we substitute in Kc=(HI)**2/(H2)*(I2) we get 54.3=(2x+0.0224)**2/((0.00623-x)*(0.00414-x)) simplifying we get 50.3x**2-0.654x+8.98*10**-4=0\n",
      "a=50.3 \n",
      "b=-0.654 \n",
      "c=8.98*10**-4 \n",
      "\n",
      "#Calculation\n",
      "x1=(-b+math.sqrt(b**2-4*a*c))/(2*a) \n",
      "x2=(-b-math.sqrt(b**2-4*a*c))/(2*a) \n",
      "if(x1>I2o):\n",
      "    x=x2 \n",
      "else:\n",
      "    x=x1 \n",
      "H2=0.00623-x \n",
      "I2=0.00414-x \n",
      "HI=2*x+0.0224 \n",
      "\n",
      "#Result\n",
      "print\"The equilibrium concentration of H2 is :\",round(H2,5),\"M\"\n",
      "print\"The equilibrium concentration of I2 is :\",round(I2,5),\"M\"\n",
      "print\"The equilibrium concentration of HI is :\",round(HI,4),\"M\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium concentration of H2 is : 0.00467 M\n",
        "The equilibrium concentration of I2 is : 0.00258 M\n",
        "The equilibrium concentration of HI is : 0.0255 M\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:14.11,Page no:639"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Kc=2.37*10**-3 #equilibrium constant for the reaction\n",
      "N2=0.683 #conc of N2, M\n",
      "H2=8.8 #conc of H2, M\n",
      "NH3=3.65 #conc of NH3, M\n",
      "\n",
      "#Calculation\n",
      "Qc=NH3**2/(N2*H2**3) #reaction quotient initial\n",
      "print\"Qc=%.2e\"%Qc\n",
      "\n",
      "#Result\n",
      "if(Qc==Kc):\n",
      "    d=\"the system is in equilibrium\" \n",
      "elif(Qc<Kc):\n",
      "    d=\"the system is not in equilibrium and the reaction will move from left to right\" \n",
      "else:\n",
      "    d=\"the system is not in equilibrium and the reaction will move from right to left\" \n",
      "print d\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Qc=2.86e-02\n",
        "the system is not in equilibrium and the reaction will move from right to left\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}