summaryrefslogtreecommitdiff
path: root/sample_notebooks/NirenNegandhi/ch2_1.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:40:35 +0530
committerkinitrupti2017-05-12 18:40:35 +0530
commitd36fc3b8f88cc3108ffff6151e376b619b9abb01 (patch)
tree9806b0d68a708d2cfc4efc8ae3751423c56b7721 /sample_notebooks/NirenNegandhi/ch2_1.ipynb
parent1b1bb67e9ea912be5c8591523c8b328766e3680f (diff)
downloadPython-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.tar.gz
Python-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.tar.bz2
Python-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.zip
Revised list of TBCs
Diffstat (limited to 'sample_notebooks/NirenNegandhi/ch2_1.ipynb')
-rwxr-xr-xsample_notebooks/NirenNegandhi/ch2_1.ipynb505
1 files changed, 0 insertions, 505 deletions
diff --git a/sample_notebooks/NirenNegandhi/ch2_1.ipynb b/sample_notebooks/NirenNegandhi/ch2_1.ipynb
deleted file mode 100755
index e79c5ef9..00000000
--- a/sample_notebooks/NirenNegandhi/ch2_1.ipynb
+++ /dev/null
@@ -1,505 +0,0 @@
-{
- "metadata": {
- "name": "",
- "signature": "sha256:d53ace7eee908f1b365cd69f5f5bf3b12191ff7d43291af068a8947558149234"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 2: Special Theory of Relativity"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.2, Page 34"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "ly = 9.46e+015; # Distance travelled by light in an year, m\n",
- "c = 3e+008; # Speed of light, m/s\n",
- "L = 4.30*ly; # Distance of Alpha Centauri from earth, m\n",
- "T0 = 16*365.25*24*60*60; # Proper time in system K_prime, s\n",
- "\n",
- "#Calculations\n",
- "# As time measured on earth, T = 2*L/v = T0_prime/sqrt(1-(v/c)^2), solving for v\n",
- "v = math.sqrt(4*L**2/(T0**2+4*L**2/c**2)); # Speed of the aircraft, m/s\n",
- "gama = 1/math.sqrt(1-(v/c)**2); # Relativistic factor\n",
- "T = gama*T0/(365.25*24*60*60); # Time interval as measured on Earth, y\n",
- "\n",
- "#Results\n",
- "print \"The speed of the aircraft = %4.2e m/s\" %v\n",
- "print \"The time interval as measured on earth = %4.1f y\"%T\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The speed of the aircraft = 1.42e+08 m/s\n",
- "The time interval as measured on earth = 18.2 y\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.3, Page 38"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "L0 = 4.30; # Distance of Alpha Centauri from earth, ly\n",
- "c = 3e+008; # Speed of light, m/s\n",
- "T = 8; # Proper time in system K_prime, y\n",
- "\n",
- "#Calculations\n",
- "# As v/c = L0*sqrt(1-(v/c)^2)/(c*T) or bita = L0*sqrt(1-bita^2)/(c*T), solving for bita\n",
- "bita = math.sqrt(L0**2/(T**2 + L0**2)); # Boost parameter\n",
- "v = L0*math.sqrt(1-bita**2)/T; # Speed of the aircraft, c units\n",
- "\n",
- "#Results\n",
- "print \"The boost parameter = %5.3f\"%bita\n",
- "print \"The speed of the aircraft = %5.3fc units\"%v"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The boost parameter = 0.473\n",
- "The speed of the aircraft = 0.473c units\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.4, Page 40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "c = 1; # For simplicity assume speed of light to be unity, m/s\n",
- "bita = 0.600; # Boost parameter\n",
- "gama = 1/math.sqrt(1-bita**2); # Relativistic factor\n",
- "u_x_prime = 0; # Speed of the protons in spaceship frame along x-axis, m/s\n",
- "u_y_prime = 0.99*c; # Speed of the protons in spaceship frame along y-axis, m/s\n",
- "u_z_prime = 0; # Speed of the protons in spaceship frame along z-axis, m/s\n",
- "v = 0.60*c; # Speed of the spaceship w.r.t. space station, m/s\n",
- "\n",
- "#Calculations\n",
- "u_x = (u_x_prime + v)/(1 + v/c**2*u_x_prime); # Speed of protons in space station frame along x-axis, m/s\n",
- "u_y = u_y_prime/(gama*(1 + v/c**2*u_x_prime)); # Speed of protons in space station frame along y-axis, m/s\n",
- "u_z = u_z_prime/(gama*(1 + v/c**2*u_x_prime)); # Speed of protons in space station frame along y-axis, m/s\n",
- "u = math.sqrt(u_x**2 + u_y**2 + u_z**2); # The speed of the protons measured by an observer in the space station, m/s\n",
- "\n",
- "#Result\n",
- "print \"The speed of the protons measured by an observer in the space station = %5.3fc units\"%u"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The speed of the protons measured by an observer in the space station = 0.994c units\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.5, Page 45"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Variable declaration\n",
- "c = 2.998e+008; # Speed of light in free space, m/s\n",
- "v = 7712; # Speed of the space shuttle, m/s\n",
- "bita = v/c; # Boost parameter\n",
- "T_loss = 295.02; # Total measured loss in time, ps/sec\n",
- "Add_T_loss = 35.0; # Additional time loss for moving clock from general relativity prediction, ps/s\n",
- "\n",
- "#Calculations\n",
- "# From time dilation relation, T0_prime = T*sqrt(1 - bita^2), solving for (T - T0_prime)/T\n",
- "Calc_T_loss = bita**2/2*1e+012; # Expected time lost per sec by the moving clock, ps/sec\n",
- "Measured_T_loss = T_loss + Add_T_loss; # Total measured loss in time per sec as per special relativity, ps/s\n",
- "percent_T_loss = (Calc_T_loss - Measured_T_loss)/Calc_T_loss*100; # Percentage deviation of measured and the calculated time loss per sec\n",
- "T = 6.05e+05; # Total time of the seven-day mission, s\n",
- "delta_T = Calc_T_loss*1e-012*T; # The total time difference between the moving and stationary clocks during the entire shuttle flight, s\n",
- "\n",
- "#Results\n",
- "print \"The expected time lost per second for the moving clock = %6.2f ps\"%Calc_T_loss\n",
- "print \"The percentage deviation of measured and the calculated time loss per sec for moving clock = %3.1f percent\"%percent_T_loss #answer differs due to rounding errors\n",
- "print \"The total time difference between the moving and stationary clocks during the entire shuttle flight = %3.1f ms\"%(delta_T/1e-003)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The expected time lost per second for the moving clock = 330.86 ps\n",
- "The percentage deviation of measured and the calculated time loss per sec for moving clock = 0.3 percent\n",
- "The total time difference between the moving and stationary clocks during the entire shuttle flight = 0.2 ms\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.8, Page 57"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "f0 = 1; # For simplicity assume frequency of the signals sent by Frank, Hz\n",
- "# Outbound trip\n",
- "bita = -0.8; # Boost parameter for receding frames\n",
- "\n",
- "#Calculations&Results\n",
- "f = math.sqrt(1+bita)/math.sqrt(1-bita)*f0; # The frequency of the signals received by Mary in outbound trip, Hz\n",
- "print \"The frequency of the signals received by Mary in outbound trip = f0/%d\", math.ceil(f*9)\n",
- "# Return trip\n",
- "bita = +0.8; # Boost parameter for approaching frames\n",
- "f = math.sqrt(1+bita)/math.sqrt(1-bita)*f0; # The frequency of the signals received by Mary in return trip, Hz\n",
- "print \"The frequency of the signals received by Mary in return trip = %df0\"%f"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The frequency of the signals received by Mary in outbound trip = f0/%d 3.0\n",
- "The frequency of the signals received by Mary in return trip = 3f0\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.11, Page 64"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "q = 1.6e-019; # Charge on an electron, C\n",
- "V = 25e+003; # Accelerating potential, volt\n",
- "K = q*V; # Kinetic energy of electrons, J\n",
- "m = 9.11e-031; # Rest mass of an electron, kg\n",
- "c = 3.00e+08; # Speed of light, m/s\n",
- "\n",
- "#Calculations\n",
- "# From relativistic kinetic energy formula, K = (gama - 1)*m*C^2, solving for gama\n",
- "gama = 1 + K/(m*c**2); # Relativistic factor\n",
- "bita = math.sqrt((gama**2-1)/gama**2); # Boost parameter\n",
- "u = bita*c; # Speed of the electrons, m/s\n",
- "# From non-relativistic expression, K = 1/2*m*u^2, solving for u\n",
- "u_classical = math.sqrt(2*K/m); # Non-relativistic speed of the electrons, m/s\n",
- "u_error = (u_classical - u)/u_classical*100; # Percentage error in speed of electrons, m/s\n",
- "\n",
- "#Results\n",
- "print \"The relativistic speed of the accelerated electrons = %4.2e m/s\"%u\n",
- "print \"The classical speed is about %d percent greater than the relativistic speed\"%math.ceil(u_error)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The relativistic speed of the accelerated electrons = 9.04e+07 m/s\n",
- "The classical speed is about 4 percent greater than the relativistic speed\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.13, Page 69"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "c = 1; # For simplicity assume peed of light to be unity, m/s\n",
- "K = 2.00; # Kinetic energy of protons, GeV\n",
- "E0 = 0.938; # Rest mass of a proton, GeV\n",
- "E = K + E0; # Total energy of the proton, GeV\n",
- "\n",
- "#Calculations\n",
- "# From relativistic mass energy relation, E^2 = (p*c)^2+E0^2, solving for p\n",
- "p = math.sqrt(E**2 - E0**2)/c; # Momentum of the protons, GeV/c\n",
- "# As E = gama*E0, solving for gama\n",
- "gama = E/E0; # Relativistic factor\n",
- "bita = math.sqrt((gama**2-1)/gama**2); # Boost parameter\n",
- "v = bita*3.00e+08; # Speed of 2 GeV proton, m/s\n",
- "\n",
- "#Results\n",
- "print \"The energy of each initial proton = %5.3f GeV\"%E\n",
- "print \"The momentum of each initial proton = %4.2f GeV/c\"%p\n",
- "print \"The speed of each initial proton = %3.1e m/s\"%v\n",
- "print \"The relativistic factor, gama = %4.2f\"%gama\n",
- "print \"The boost parameter, beta = %5.3f\"%bita"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The energy of each initial proton = 2.938 GeV\n",
- "The momentum of each initial proton = 2.78 GeV/c\n",
- "The speed of each initial proton = 2.8e+08 m/s\n",
- "The relativistic factor, gama = 3.13\n",
- "The boost parameter, beta = 0.948\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.15, Page 71"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Variable declaration\n",
- "E_d = 1875.6; # Rest mass energy of the deuterium, MeV\n",
- "E_pi = 139.6; # Rest mass energy of the pion, MeV\n",
- "E_p = 938.3; # Rest mass energy of the proton, MeV\n",
- "\n",
- "#Calculation\n",
- "K = 1./2*(E_d + E_pi - 2*E_p); # Minimum kinetic energy of the protons, MeV \n",
- "\n",
- "#Result\n",
- "print \"The minimum kinetic energy of the protons = %2d MeV\"%K"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The minimum kinetic energy of the protons = 69 MeV\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.16, Page 72"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Variable declaration\n",
- "u = 931.5; # Energy equivalent of 1 amu, MeV\n",
- "c = 1; # Speed of light in vacuum, m/s\n",
- "\n",
- "#Calculations\n",
- "m_e = 0.000549*u; # Rest mass of an electron, MeV/c^2\n",
- "m_p = 1.007276*u; # Rest mass of a proton, MeV/c^2\n",
- "m_n = 1.008665*u; # Rest mass of a neutron, MeV/c^2\n",
- "m_He = 4.002603*u; # Rest mass of a helium, MeV/c^2\n",
- "M_He = m_He - 2*m_e; # Mass of He nucleus, MeV/c^2\n",
- "E_B_He = (2*m_p + 2*m_n - M_He)*c**2; # Binding energy of the He nucleus, MeV\n",
- "\n",
- "#Result\n",
- "print \"The binding energy of the He nucleus = %4.1f MeV\"%E_B_He"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The binding energy of the He nucleus = 28.3 MeV\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.17, Page 72"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Variable declaration\n",
- "u = 931.5; # Energy equivalent of 1 amu, MeV/u\n",
- "c = 1; # For simplicity assume speed of light in vacuum to be unity, m/s\n",
- "E_B = 4.24; # The dissociationenergy of the NaCl molecule, MeV\n",
- "\n",
- "#Calculations\n",
- "M = 58.44*u; # Energy corresponding to molecular mass of NaCl, MeV\n",
- "f_r = E_B/M; # The fractional mass increase of the Na and Cl atoms\n",
- "\n",
- "#Result\n",
- "print \"The fractional mass increase of the Na and Cl atoms when they are not bound together in NaCl = %4.1e\"%(f_r/1e+006)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The fractional mass increase of the Na and Cl atoms when they are not bound together in NaCl = 7.8e-11\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.18, Page 72"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "c = 1; # For simplicity assume speed of light in vacuum to be unity, m/s\n",
- "E0_n = 940; # Rest energy of a neutron, MeV\n",
- "E0_pi = 140; # Rest energy of a pion, MeV\n",
- "p_n = 4702; # Momentum of the neutron, MeV/c\n",
- "p_pi = 169; # Momentum of the pion, MeV/c\n",
- "\n",
- "#Calculations\n",
- "E_n = math.sqrt((p_n*c)**2+E0_n**2); # Total energy of the neutron, MeV\n",
- "E_pi = math.sqrt((p_pi*c)**2+E0_pi**2); # Total energy of the pion, MeV\n",
- "E = E_n + E_pi; # Total energy of the reaction, MeV\n",
- "p_sigma = p_n + p_pi; # Momentum of the sigma particle, MeV/c\n",
- "E0_sigma = math.sqrt(E**2 - (p_sigma*c)**2); # Rest mass energy of the sigma particle, MeV\n",
- "m_sigma = E0_sigma/c**2; # Rest mass of sigma particle, MeV/c^2;\n",
- "K = E - E0_sigma; # Kinetic energy of sigma particle, MeV\n",
- "\n",
- "#Results\n",
- "print \"The rest mass of sigma particle = %4d MeV/c^2\"%math.ceil(m_sigma)\n",
- "print \"The kinetic energy of sigma particle = %4d MeV\"%math.ceil(K)\n",
- "\n",
- "#Answers differ due to rounding errors"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The rest mass of sigma particle = 1192 MeV/c^2\n",
- "The kinetic energy of sigma particle = 3824 MeV\n"
- ]
- }
- ],
- "prompt_number": 10
- }
- ],
- "metadata": {}
- }
- ]
-} \ No newline at end of file