{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 5: Uncertainity Principle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page number 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in momentum is 0.211 *10**-20 kg m/sec\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "hby2pi=1.055*10**-34;      #plancks constant(J s)\n",
    "deltax=5*10**-14;          #uncertainity(m)\n",
    "\n",
    "#Calculations\n",
    "delta_px=hby2pi/deltax;    #uncertainity in momentum(kg m/sec)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in momentum is\",delta_px*10**20,\"*10**-20 kg m/sec\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page number 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in position is 3.85 *10**-3 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.6*10**-34;      #plancks constant(J s)\n",
    "m=9.1*10**-31;      #mass(kg)\n",
    "v=600;              #speed(m/s)\n",
    "deltap=(0.005/100)*m*v;  #uncertainity in momentum(kg m/sec)\n",
    "\n",
    "#Calculations\n",
    "deltax=h/(2*math.pi*deltap);    #uncertainity in position(m)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in position is\",round(deltax*10**3,2),\"*10**-3 m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page number 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in momentum is 3.5 *10**-24 kg ms-1\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltax=3*10**-11;    #uncertainity(m)\n",
    "\n",
    "#Calculations\n",
    "deltap=h/(2*math.pi*deltax);    #uncertainity in momentum(kg m/sec)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in momentum is\",round(deltap*10**24,1),\"*10**-24 kg ms-1\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page number 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in determination of energy is 6.59 *10**-8 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltat=10**-8;       #lifetime of excited atom(sec)\n",
    "e=1.6*10**-19;       #charge(coulomb)\n",
    "\n",
    "#Calculations\n",
    "deltaE=h/(2*math.pi*deltat*e);    #uncertainity in determination of energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in determination of energy is\",round(deltaE*10**8,2),\"*10**-8 eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page number 181"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in measurement of angular momentum is 2.17 *10**-29 Js\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltaphi=math.pi/(180*60*60);      \n",
    "\n",
    "#Calculations\n",
    "deltaL=h/(2*math.pi*deltaphi);    #uncertainity in measurement of angular momentum(Js)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in measurement of angular momentum is\",round(deltaL*10**29,2),\"*10**-29 Js\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6, Page number 181"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in position is 5.27 *10**-34 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "m=25*10**-3;         #mass(kg)\n",
    "v=400;               #speed(m/s)\n",
    "deltap=(2/100)*m*v;  #uncertainity in momentum(kg m/sec)\n",
    "\n",
    "#Calculations\n",
    "deltax=h/(2*math.pi*deltap);    #uncertainity in position(m)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in position is\",round(deltax*10**34,2),\"*10**-34 m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 7, Page number 181"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "percentage of uncertainity in momentum is 3.1 %\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltax=2*10**-10;    #uncertainity in position(m)\n",
    "m=9.1*10**-31;       #mass(kg)\n",
    "e=1.6*10**-19;       #charge(coulomb)\n",
    "V=1000;              #voltage(V)\n",
    "\n",
    "#Calculations\n",
    "deltap=h/(2*math.pi*deltax);      #uncertainity in momentum(kg m/s)\n",
    "p=math.sqrt(2*m*e*V);             #momentum(kg m/s)\n",
    "pp=deltap*100/p;                  #percentage of uncertainity in momentum\n",
    "\n",
    "#Result\n",
    "print \"percentage of uncertainity in momentum is\",round(pp,1),\"%\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 8, Page number 182"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in velocity of electron is 5.79 *10**4 ms-1\n",
      "uncertainity in velocity of proton is 31.545 ms-1\n",
      "answer for uncertainity in velocity of proton given in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltax=20*10**-10;   #uncertainity in position(m)\n",
    "me=9.1*10**-31;      #mass of electron(kg)\n",
    "mp=1.67*10**-27;     #mass of proton(kg)\n",
    "\n",
    "#Calculations\n",
    "deltave=h/(2*math.pi*deltax*me);      #uncertainity in velocity of electron(ms-1)\n",
    "deltavp=h/(2*math.pi*deltax*mp);      #uncertainity in velocity of proton(ms-1)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in velocity of electron is\",round(deltave*10**-4,2),\"*10**4 ms-1\"\n",
    "print \"uncertainity in velocity of proton is\",round(deltavp,3),\"ms-1\"\n",
    "print \"answer for uncertainity in velocity of proton given in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 9, Page number 182"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum uncertainity in momentum is 1.3 *10**-20 kg m/s\n",
      "minimum kinetic energy of proton is 0.32 MeV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration  \n",
    "h=6.62*10**-34;      #plancks constant(J s)\n",
    "deltax=8*10**-15;    #uncertainity in position(m)\n",
    "mp=1.67*10**-27;     #mass(kg)\n",
    "e=1.6*10**-19;       #charge(coulomb)\n",
    "\n",
    "#Calculations\n",
    "deltap=h/(2*math.pi*deltax);      #minimum uncertainity in momentum(kg m/s)\n",
    "ke=deltap**2/(2*mp*e);            #minimum kinetic energy of proton(eV)\n",
    "\n",
    "#Result\n",
    "print \"minimum uncertainity in momentum is\",round(deltap*10**20,1),\"*10**-20 kg m/s\"\n",
    "print \"minimum kinetic energy of proton is\",round(ke/10**6,2),\"MeV\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
