{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1: Atomic Spectra"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page number 55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength of emitted photon is 1.281 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "n1=3;\n",
    "n2=5;        #states\n",
    "RH=1.0977*10**7;\n",
    "\n",
    "#Calculations\n",
    "newbar=RH*((1/n1**2)-(1/n2**2));\n",
    "lamda=10**6/newbar;         #wavelength of emitted photon(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"wavelength of emitted photon is\",round(lamda,3),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page number 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of principal quantum number of two orbits is 14 / 11\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "E1=1.21;\n",
    "E2=1.96;        #energy of two orbits(eV)\n",
    "\n",
    "#Calculations\n",
    "n1=math.sqrt(E2);\n",
    "n2=math.sqrt(E1);       #ratio of principal quantum number of two orbits\n",
    "n1=n1*10;\n",
    "n2=n2*10;               #multiply and divide the ratio by 10\n",
    "\n",
    "#Result\n",
    "print \"ratio of principal quantum number of two orbits is\",int(n1),\"/\",int(n2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page number 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic moment of proton is 5.041 *10**-27 Am**2\n",
      "answer 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",
    "e=1.6*10**-19;            #charge(coulomb)\n",
    "mp=1.672*10**-27;         #mass of electron(kg)\n",
    "h=6.62*10**-34;           #planks constant(Js)\n",
    "\n",
    "#Calculations\n",
    "mewp=e*h/(4*math.pi*mp);  #magnetic moment of proton(Am**2) \n",
    "\n",
    "#Result\n",
    "print \"magnetic moment of proton is\",round(mewp*10**27,3),\"*10**-27 Am**2\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page number 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "specific charge of electron is 1.7604 *10**11 coulomb/kg\n",
      "answer 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",
    "mewB=9.274*10**-24;       #bohr magneton(amp m**2)\n",
    "h=6.62*10**-34;           #planks constant(Js)\n",
    "\n",
    "#Calculations\n",
    "ebym=mewB*4*math.pi/h;    #specific charge of electron(coulomb/kg)      \n",
    "\n",
    "#Result\n",
    "print \"specific charge of electron is\",round(ebym/10**11,4),\"*10**11 coulomb/kg\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page number 57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength separation is 0.3358 angstrom\n",
      "answer 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",
    "e=1.6*10**-19;      #charge(coulomb)\n",
    "B=1;                #flux density(Wb/m**2)\n",
    "lamda=6000*10**-10; #wavelength(m)\n",
    "m=9.1*10**-31;      #mass(kg)\n",
    "c=3*10**8;          #velocity of light(m/sec)\n",
    "\n",
    "#Calculations\n",
    "d_lamda=B*e*(lamda**2)/(4*math.pi*m*c);     #wavelength separation(m)\n",
    "d_lamda=2*d_lamda*10**10;                   #wavelength separation(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"wavelength separation is\",round(d_lamda,4),\"angstrom\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6, Page number 57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy of electron in 1st and 2nd orbit is -13.6 eV and -3.4 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "n1=1;\n",
    "n2=2;        #states\n",
    "\n",
    "#Calculations\n",
    "E1=-13.6/n1**2;     #energy of electron in 1st orbit(eV)\n",
    "E2=-13.6/n2**2;     #energy of electron in 2nd orbit(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy of electron in 1st and 2nd orbit is\",E1,\"eV and\",E2,\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 8, Page number 58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "linear momentum is 2.107 *10**-24 kg ms-1\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "lamda=0.5*10**-10;        #radius of 1st orbit(m)\n",
    "h=6.62*10**-34;           #planks constant(Js)\n",
    "\n",
    "#Calculations\n",
    "L=h/(2*math.pi*lamda);    #linear momentum(kg ms-1)\n",
    "\n",
    "#Result\n",
    "print \"linear momentum is\",round(L*10**24,3),\"*10**-24 kg ms-1\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 9, Page number 58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "state to which it is excited is 4\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration   \n",
    "E1=-13.6;     #energy of electron in 1st orbit(eV)\n",
    "E2=-12.75;    #energy of electron in 2nd orbit(eV)\n",
    "\n",
    "#Calculations\n",
    "n=math.sqrt(-E1/(E2-E1));    #state to which it is excited\n",
    "\n",
    "#Result\n",
    "print \"state to which it is excited is\",int(n)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 10, Page number 59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bohr magneton is 9.262 *10**-24 coulomb Js kg-1\n",
      "answer 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",
    "e=1.6*10**-19;          #charge(coulomb)\n",
    "m=9.1*10**-31;          #mass of electron(kg)\n",
    "h=6.62*10**-34;         #planks constant(Js)\n",
    "\n",
    "#Calculations\n",
    "mewB=e*h/(4*math.pi*m);  #bohr magneton(coulomb Js kg-1) \n",
    "\n",
    "#Result\n",
    "print \"bohr magneton is\",round(mewB*10**24,3),\"*10**-24 coulomb Js kg-1\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 11, Page number 59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "component separation is 2.7983 *10**8 Hz\n",
      "answer 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",
    "e=1.6*10**-19;          #charge(coulomb)\n",
    "m=9.1*10**-31;          #mass of electron(kg)\n",
    "B=0.02;                 #magnetic field(T)\n",
    "\n",
    "#Calculations\n",
    "delta_new=e*B/(4*math.pi*m);    #component separation(Hz)\n",
    "\n",
    "#Result\n",
    "print \"component separation is\",round(delta_new/10**8,4),\"*10**8 Hz\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 14, Page number 61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "magnetic flux density is 2.14 Tesla\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "e=1.6*10**-19;          #charge(coulomb)\n",
    "m=9.1*10**-31;          #mass of electron(kg)\n",
    "lamda=10000*10**-10;    #wavelength(m)\n",
    "c=3*10**8;              #velocity of light(m/sec)\n",
    "d_lamda=1*10**-10;      #wavelength separation(m)\n",
    "\n",
    "#Calculations\n",
    "B=d_lamda*4*math.pi*m*c/(e*lamda**2);      #magnetic flux density(Tesla)\n",
    "\n",
    "#Result\n",
    "print \"magnetic flux density is\",round(B,2),\"Tesla\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 19, Page number 66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "separation is 0.33 angstrom\n",
      "wavelength of three components is 4226 angstrom 4226.33 angstrom 4226.666 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "e=1.6*10**-19;          #charge(coulomb)\n",
    "m=9.1*10**-31;          #mass of electron(kg)\n",
    "lamda=4226;             #wavelength(angstrom)\n",
    "c=3*10**8;              #velocity of light(m/sec)\n",
    "B=4;                    #magnetic field(Wb/m**2)\n",
    "\n",
    "#Calculations\n",
    "dnew=B*e/(4*math.pi*m);    \n",
    "dlamda=lamda**2*dnew*10**-10/c;      #separation(angstrom)\n",
    "dlamda1=lamda+dlamda;\n",
    "dlamda2=dlamda1+dlamda;    #wavelength of three components(Hz)\n",
    "\n",
    "#Result\n",
    "print \"separation is\",round(dlamda,2),\"angstrom\"\n",
    "print \"wavelength of three components is\",lamda,\"angstrom\",round(dlamda1,2),\"angstrom\",round(dlamda2,3),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 21, Page number 68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number of elements would be 110\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "n1=1;\n",
    "n2=2;        \n",
    "n3=3;\n",
    "n4=4;\n",
    "n5=5;\n",
    "\n",
    "#Calculations\n",
    "e1=2*n1**2;     #maximum number of electrons in 1st orbit\n",
    "e2=2*n2**2;     #maximum number of electrons in 2nd orbit\n",
    "e3=2*n3**2;     #maximum number of electrons in 3rd orbit\n",
    "e4=2*n4**2;     #maximum number of electrons in 4th orbit\n",
    "e5=2*n5**2;     #maximum number of electrons in 5th orbit\n",
    "e=e1+e2+e3+e4+e5;      #number of elements\n",
    "\n",
    "#Result\n",
    "print \"number of elements would be\",e"
   ]
  }
 ],
 "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
}