summaryrefslogtreecommitdiff
path: root/sample_notebooks/SandeshNaik/ch8.ipynb
blob: ffd91f685ab5d8fcb7297d8ff0fc10380e1970e5 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:983adfa64951b4c71938be02f10b2d0d40d82e513916f6ced5042486c6dc7d21"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8: Particle Physics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5.1, Page 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# Proton and antiproton annihilate to produced three pions\n",
      "E_p = 938; # Energy of proton, MeV\n",
      "E_pi = 139.5; # Energy of pions, MeV\n",
      "E_pi_0 = 134.9; # Energy of pi_0_ion, MeV\n",
      "\n",
      "#Calculations\n",
      "E_KE = (2*E_p-(2*E_pi+E_pi_0))/3; # The average kinetic energy of each pions, MeV\n",
      "\n",
      "#Result\n",
      "print \"The average kinetic energy of each pions : %5.1f MeV\"%E_KE\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average kinetic energy of each pions : 487.4 MeV\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5.2, Page 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# Here r_1 and r_2 are two decay rates are given\n",
      "# Declare the cell\n",
      "R1 = [[0,0],[0,0]]\n",
      "R1[0][0] = 'r_1'\n",
      "R1[0][1] = 'r_2'\n",
      "\n",
      "#Calculations&Results\n",
      "print \"The inherent uncertainity in mass of particle = h(%s + %s) \"%(R1[0][0], R1[0][1]) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The inherent uncertainity in mass of particle = h(r_1 + r_2) \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7.3, Page 362"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# Declare cell for the given reaction\n",
      "R1 = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n",
      "# Enter data for the cell\n",
      "R1[0][0] = 'p'\n",
      "R1[0][1] = 1 \n",
      "R1[0][2] = 1\n",
      "R1[0][3] = 0\n",
      "R1[0][4] = 1./2\n",
      "R1[1][0] = 'K_+'\n",
      "R1[1][1] = 1\n",
      "R1[1][2] = 0\n",
      "R1[1][3] = 1\n",
      "R1[1][4] = 1./2\n",
      "R1[2][0] = 'S_+'\n",
      "R1[2][1] = 1\n",
      "R1[2][2] = 1\n",
      "R1[2][3] = -1\n",
      "R1[2][4] = 1\n",
      "R1[3][0] = 'pi_-'\n",
      "R1[3][1] = -1\n",
      "R1[3][2] = 0\n",
      "R1[3][3] = 0\n",
      "R1[3][4] = 1\n",
      "R1[4][0] = 'S_0'\n",
      "R1[4][1] = 0\n",
      "R1[4][2] = 1\n",
      "R1[4][3] = -1\n",
      "R1[4][4] = 0\n",
      "R1[5][0] = 'p_-'\n",
      "R1[5][1] = -1\n",
      "R1[5][2] = -1\n",
      "R1[5][3] = 0\n",
      "R1[5][4] = 1./2\n",
      "R1[6][0] = 'n_0'\n",
      "R1[6][1] = 0\n",
      "R1[6][2] = 0\n",
      "R1[6][3] = 0\n",
      "R1[6][4] = 0\n",
      "\n",
      "\n",
      "#Calculations&Results\n",
      "def check_Isotopic_no(Ir_sum,Ip_sum):\n",
      "    if Ir_sum == Ip_sum:\n",
      "        f = 1;\n",
      "    else: \n",
      "        f = 0;\n",
      "    return f\n",
      "\n",
      "\n",
      "# Declare a function returning equality status of proton number\n",
      "def check_strangeness(sr_sum,sp_sum):\n",
      "    if sr_sum == sp_sum:\n",
      "        f = 1;\n",
      "    else:\n",
      "        f = 0;\n",
      "    return f\n",
      "        \n",
      "def check_charge(cr_sum,cp_sum):\n",
      "    if cr_sum == cp_sum:\n",
      "        f = 1;\n",
      "    else:\n",
      "        f = 0;\n",
      "    return f\n",
      "        \n",
      "# Declare a function returning equality status of lepton number\n",
      "          \n",
      "#Reaction-I\n",
      "print \"\\n\\nReaction-I:\\n\\n\"\n",
      "Ir_sum = R1[0][4]+R1[0][4];\n",
      "Ip_sum = R1[1][4]+R1[2][4];\n",
      "if (check_Isotopic_no(Ir_sum,Ip_sum) == 0):\n",
      "    print \"The Reaction\\n\"\n",
      "    print \"\\t%s + %s --> %s + %s \\nis  not possible\"%(R1[0][0],R1[0][0],R1[1][0],R1[2][0])\n",
      "\n",
      "#Reaction-II\n",
      "print \"\\n\\nReaction-II\"\n",
      "sr_sum = R1[0][3]+R1[3][3];\n",
      "sp_sum = R1[4][3]+R1[6][3];\n",
      "if (check_strangeness(sr_sum,sp_sum)== 0):\n",
      "    print \"\\nThe Reaction\\n\"\n",
      "    print \"\\t%s + %s --> %s + %s \\nis not possible\"%(R1[0][0],R1[3][0],R1[4][0],R1[6][0])\n",
      "\n",
      "#Reaction-III\n",
      "print \"\\n\\nReaction-III:\\n\\n\"\n",
      "cr_sum = R1[0][1]+R1[0][1];\n",
      "cp_sum = R1[0][1]+R1[0][1]+R1[0][1]+R1[5][1]; \n",
      "if (check_charge(cr_sum,cp_sum) == 1):\n",
      "    print \"The Reaction\\n\"\n",
      "    print \"\\t%s + %s --> %s + %s + %s \\nis possible\"%(R1[0][0],R1[0][0],R1[0][0],R1[0][0],R1[5][0]) \n",
      "       "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "Reaction-I:\n",
        "\n",
        "\n",
        "The Reaction\n",
        "\n",
        "\tp + p --> K_+ + S_+ \n",
        "is  not possible\n",
        "\n",
        "\n",
        "Reaction-II\n",
        "\n",
        "The Reaction\n",
        "\n",
        "\tp + pi_- --> S_0 + n_0 \n",
        "is not possible\n",
        "\n",
        "\n",
        "Reaction-III:\n",
        "\n",
        "\n",
        "The Reaction\n",
        "\n",
        "\tp + p --> p + p + p_- \n",
        "is possible\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}