summaryrefslogtreecommitdiff
path: root/Applied_Physics_for_Engineers/chapter_1.ipynb
diff options
context:
space:
mode:
authorhardythe12015-01-28 14:31:21 +0530
committerhardythe12015-01-28 14:31:21 +0530
commit53f72e6790ff23b43c8f6a0b69d6386940671429 (patch)
tree7745af6dbf2f5b2972b23f9f5a7a19c695a27321 /Applied_Physics_for_Engineers/chapter_1.ipynb
parent7b78be04fe05bf240417e22f74b3fc22e7a77d19 (diff)
downloadPython-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.tar.gz
Python-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.tar.bz2
Python-Textbook-Companions-53f72e6790ff23b43c8f6a0b69d6386940671429.zip
added books
Diffstat (limited to 'Applied_Physics_for_Engineers/chapter_1.ipynb')
-rwxr-xr-xApplied_Physics_for_Engineers/chapter_1.ipynb558
1 files changed, 558 insertions, 0 deletions
diff --git a/Applied_Physics_for_Engineers/chapter_1.ipynb b/Applied_Physics_for_Engineers/chapter_1.ipynb
new file mode 100755
index 00000000..659af082
--- /dev/null
+++ b/Applied_Physics_for_Engineers/chapter_1.ipynb
@@ -0,0 +1,558 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1: Relativistic Mechanics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.2, Page 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "delta_x = 2.45e+03; # Space difference, m\n",
+ "delta_t = 5.35e-06; # Time difference, s\n",
+ "\n",
+ "#Calculations\n",
+ "v = 0.855*c; # Speed of frame S_prime, m/s\n",
+ "delta_x_prime = 1/sqrt(1-v**2/c**2)*(delta_x - v*(delta_t))*1e-03; # Distance between two flashes as measured in S_prime frame, km\n",
+ "delta_t_prime = 1/sqrt(1-v**2/c**2)*(delta_t - v/c**2*delta_x)*1e+006; # Time between two flashes as measured in S_prime\n",
+ "\n",
+ "#Results\n",
+ "print \"The distance between two flashes as measured in S_prime frame = %4.2f km\"%delta_x_prime\n",
+ "print \"The time between two flashes as measured in S_prime frame = %4.2f micro-second\"%delta_t_prime\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The distance between two flashes as measured in S_prime frame = 2.08 km\n",
+ "The time between two flashes as measured in S_prime frame = -3.15 micro-second\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.4, Page 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from sympy import *\n",
+ "c = Symbol('c')\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; # Speed of light in vacuum, m/s\n",
+ "u_x_prime = c; # Velocity of photon as measured in S_prime frame, m/s\n",
+ "v = c; # Velocity of frame S_prime relative to S frame, m/s\n",
+ "\n",
+ "#Calculations\n",
+ "u_x = (u_x_prime + v)/(1+v*u_x_prime/c**2);\n",
+ "if u_x == 1: \n",
+ " ux = 'c';\n",
+ "else: \n",
+ " ux = string(u_x)+'c'; \n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of one photon as observed by the other is %c\"%ux\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The speed of one photon as observed by the other is c\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.6, Page 28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "a = 1; # For simplicity assume length of semi minor axis to be unity, m\n",
+ "c = 3e+08; # Speed of light, m/s\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#From equation 1-v^2/c^2=1/4, we derive the following expression\n",
+ "v = math.sqrt(3*c**2/4) # Velocity at which surface area of lamina reduces to half in S-frame, m/s\n",
+ "\n",
+ "\n",
+ "print \"The velocity at which surface area of lamina reduces to half in S-frame = %4.2e m/s\"%v\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity at which surface area of lamina reduces to half in S-frame = 2.60e+08 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.7, Page 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "m0 = 1; # For simplicity assume the rest mass of stick to be unity, kg\n",
+ "m = 1.5*m0; # Mass of the moving stick, kg\n",
+ "L0 = 1; # Assume resting length of the stick to be unity, m\n",
+ "\n",
+ "#Calculations\n",
+ "# As m = m0/sqrt(1-v^2/c^2) = m0*gama, solving for gama\n",
+ "gama = m/m0; # Relativistic factor\n",
+ "L = L0/gama; # Contracted length of the metre stick, m\n",
+ "\n",
+ "#Result\n",
+ "print \"The contracted length of the metre stick = %4.2f m\"%L\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The contracted length of the metre stick = 0.67 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.8, Page 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "tau0 = 2e-008; # Mean lifetime of meson at rest, m/s\n",
+ "\n",
+ "#Calculations\n",
+ "v = 0.8*c; # Velocity of moving meason, m/s\n",
+ "tau = tau0/sqrt(1-v**2/c**2); # Mean lifetime of meson in motion, m/s\n",
+ "\n",
+ "#Result\n",
+ "print \"The mean lifetime of meson in motion = %4.2e s\"%tau\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mean lifetime of meson in motion = 3.33e-08 s\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.9, Page 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "delta_t0 = 59; # Reading of the moving clock for each hour, min\n",
+ "delta_t = 60; # Reading of the stationary clock for each hour, min\n",
+ "\n",
+ "#Calculations\n",
+ "# As from Time Dilation, delta_t = delta_t0/sqrt(1-v^2/c^2), solving for v\n",
+ "v = sqrt(((delta_t**2-delta_t0**2)*c**2)/delta_t**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed at which the moving clock ticks slow = %4.2e m/s\"%v\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The speed at which the moving clock ticks slow = 5.45e+07 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.10, Page 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "tau0 = 2.5e-008; # Mean lifetime of meson at rest, m/s\n",
+ "\n",
+ "#Calculations\n",
+ "v = 0.8*c; # Velocity of moving meason, m/s\n",
+ "tau = tau0/sqrt(1-v**2/c**2); # Mean lifetime of meson in motion, m/s\n",
+ "N0 = 1; # Assume initial flux of meson beam to be unity, watt/Sq.m\n",
+ "N = N0*exp(-2); # Meson flux after time t, watt/Sq.m\n",
+ "# As N = N0*e^(-t/tau), which on comparing gives\n",
+ "t = 2*tau; # Time during which the meson beam flux reduces, s\n",
+ "d = 0.8*c*t; # The distance that the meson beam can travel before reduction in its flux, m\n",
+ "\n",
+ "#Result\n",
+ "print \"The distance that the meson beam can travel before reduction in its flux = %2d m\"%d\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The distance that the meson beam can travel before reduction in its flux = 20 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.11, Page 31"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "E0 = 1; # Rest energy of particle, unit\n",
+ "\n",
+ "#Calculations\n",
+ "E = 3*E0; # Energy of relativistically moving particle, unit\n",
+ "# E = m*c^2 and E0 = m0*c^2\n",
+ "# With m = m0/sqrt(1-v^2/c^2), we have\n",
+ "v = c*sqrt(1-(E0/E)**2); # Velocity of the moving particle, m/s\n",
+ "\n",
+ "#Result\n",
+ "print \"The velocity of the moving particle = %4.2e m/s\"%v\n",
+ "#answer differs due to rounding-off errors"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity of the moving particle = 3.00e+08 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.12, Page 32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "m0 = 9.1e-031; # Rest mass of electron, kg\n",
+ "\n",
+ "#Calculations\n",
+ "m = 11*m0; # Mass of relativistically moving electron, kg\n",
+ "E_k = (m-m0)*c**2/(1.6e-019*1e+06); # Kinetic energy of moving electron, MeV\n",
+ "# As m = m0/sqrt(1-v^2/c^2), solving for v\n",
+ "v = c*sqrt(1-(m0/m)**2); # The velocity of the moving electron, m/s\n",
+ "p = m*v; # Momentum of moving electron, kg-m/s\n",
+ "\n",
+ "#Results\n",
+ "print \"The kinetic energy of moving electron = %4.2f MeV\"%E_k\n",
+ "print \"The momentum of moving electron = %4.2e kg-m/s\"%p\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The kinetic energy of moving electron = 5.12 MeV\n",
+ "The momentum of moving electron = 2.99e-21 kg-m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.13, Page 32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, m/s\n",
+ "E0 = 0.5; # Rest energy of the electron, MeV\n",
+ "\n",
+ "#Calculations\n",
+ "v1 = 0.6*c; # Initial velocity of the electron, m/s\n",
+ "v2 = 0.8*c; # Final velocity of the electron, m/s\n",
+ "W = (1/sqrt(1-v2**2/c**2)-1/sqrt(1-v1**2/c**2))*E0; # The amount of work to be done to increase the speed of the electron, MeV\n",
+ "\n",
+ "#Result\n",
+ "print \"The amount of work to be done to increase the speed of an electron = %4.2e J\"%(W*1e+06*1.6e-019)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amount of work to be done to increase the speed of an electron = 3.33e-14 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.14, Page 33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; # Assume speed of light in vacuum to be unity, unit\n",
+ "m0 = 1; # For simplicity assume rest mass of the particle to be unity, unit\n",
+ "\n",
+ "#Calculations\n",
+ "v = c/sqrt(2); # Given speed of the particle, m/s\n",
+ "gama = 1/sqrt(1-v**2/c**2); # Relativistic factor\n",
+ "m = gama*m0; # The relativistic mass of the particle, unit\n",
+ "p = m*v; # The relativistic momentum of the particle, unit\n",
+ "E = m*c**2; # The relativistic total eneryg of the particle, unit\n",
+ "E_k = (m-m0)*c**2; # The relativistic kinetic energy of the particle, unit\n",
+ "\n",
+ "#Results\n",
+ "print \"The relativistic mass of the particle = %5.3fm\"%m\n",
+ "print \"The relativistic momentum of the particle = %1.0gm0c\"%p\n",
+ "print \"The relativistic total energy of the particle = %5.3fm0c^2\"%E\n",
+ "print \"The relativistic kinetic energy of the particle = %5.3fm0c^2\"%E_k\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The relativistic mass of the particle = 1.414m\n",
+ "The relativistic momentum of the particle = 1m0c\n",
+ "The relativistic total energy of the particle = 1.414m0c^2\n",
+ "The relativistic kinetic energy of the particle = 0.414m0c^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.15, Page 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, unit\n",
+ "m0 = 9.1e-031; # Rest mass of the electron, kg\n",
+ "m = 1.67e-027; # Rest mass of the proton, kg\n",
+ "\n",
+ "#Calculations\n",
+ "# As m = m0/sqrt(1-v^2/c^2), solving for v\n",
+ "v = c*sqrt(1-(m0/m)**2); # Velocity of the electron, m/s\n",
+ "\n",
+ "#Result\n",
+ "print \"The velocity of the electron to have its mass equal to mass of the proton = %5.3e m/s\"%v\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity of the electron to have its mass equal to mass of the proton = 3.000e+08 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.17, Page 35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3e+008; # Speed of light in vacuum, unit\n",
+ "m0 = 9.1e-031; # Rest mass of the electron, kg\n",
+ "E_k = 0.1*1e+006*1.6e-019; # Kinetic energy of the electron, J\n",
+ "\n",
+ "#Calculations&Results\n",
+ "v = sqrt(2*E_k/m0); # Classical speed of the electron, m/s\n",
+ "print \"The classical speed of the electron = %5.3e m/s\"%v\n",
+ "# As E_k = (m-m0)*c^2 = (1/sqrt(1-v^2/c^2)-1)*m0*c^2, solving for v\n",
+ "v = c*sqrt(1-(m0*c**2/(E_k+m0*c**2))**2); # Relativistic speed of the electron, m/s\n",
+ "print \"The relativistic speed of the electron = %5.3e m/s\"%v\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The classical speed of the electron = 1.875e+08 m/s\n",
+ "The relativistic speed of the electron = 1.644e+08 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file