diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | 4a1f703f1c1808d390ebf80e80659fe161f69fab (patch) | |
tree | 31b43ae8895599f2d13cf19395d84164463615d9 /sample_notebooks/SandeshNaik | |
parent | 9d260e6fae7328d816a514130b691fbd0e9ef81d (diff) | |
download | Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2 Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip |
add books
Diffstat (limited to 'sample_notebooks/SandeshNaik')
-rwxr-xr-x | sample_notebooks/SandeshNaik/ch8.ipynb | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/sample_notebooks/SandeshNaik/ch8.ipynb b/sample_notebooks/SandeshNaik/ch8.ipynb new file mode 100755 index 00000000..ffd91f68 --- /dev/null +++ b/sample_notebooks/SandeshNaik/ch8.ipynb @@ -0,0 +1,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": {} + } + ] +}
\ No newline at end of file |