{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 6: Schrodinger Wave Mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 8, Page number 228"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy levels are 38 eV 150 eV 339 eV\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;        #mass of electron(kg)\n",
    "e=1.6*10**-19;        #charge(coulomb)\n",
    "a=10**-10;            #width(m)\n",
    "h=6.62*10**-34;       #planck's constant\n",
    "n1=1;\n",
    "n2=2;\n",
    "n3=3;\n",
    "\n",
    "#Calculation\n",
    "Ex=h**2/(8*e*m*a**2);  #energy(eV)\n",
    "E1=Ex*n1**2;         #energy at 1st level(eV)\n",
    "E2=Ex*n2**2;         #energy at 2nd level(eV)\n",
    "E3=Ex*n3**2;         #energy at 3rd level(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy levels are\",int(round(E1)),\"eV\",int(round(E2)),\"eV\",int(round(E3)),\"eV\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 9, Page number 229"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "probability of finding the particle is 0.133\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "deltax=1*10**-10;        #width\n",
    "a=15*10**-10;            #width(m)\n",
    "\n",
    "#Calculation\n",
    "W=2*deltax/a;            #probability of finding the particle\n",
    "\n",
    "#Result\n",
    "print \"probability of finding the particle is\",round(W,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 10, Page number 229"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "probability of transmission of electron is 0.5\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=1;          #energy(eV)\n",
    "V0=2;         #voltage(eV)\n",
    "m=9.1*10**-31;        #mass of electron(kg)\n",
    "e=1.6*10**-19;        #charge(coulomb)\n",
    "chi=1.05*10**-34;     \n",
    "a=2*10**-10;          #potential barrier\n",
    "\n",
    "#Calculation\n",
    "x=math.sqrt(2*m*(V0-E)*e);\n",
    "y=16*E*(1-(E/V0))/V0;\n",
    "T=y*math.exp(-2*a*x/chi);     #probability of transmission of electron\n",
    "\n",
    "#Result\n",
    "print \"probability of transmission of electron is\",round(T,1)\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 11, Page number 230"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fraction of electrons reflected is 0.38\n",
      "fraction of electrons transmitted is 0.62\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=0.080*10**-19;          #energy(eV)\n",
    "E_V0=0.016*10**-19;       #voltage(eV)\n",
    "\n",
    "#Calculation\n",
    "x=math.sqrt(E);\n",
    "y=math.sqrt(E_V0);\n",
    "R=(x-y)/(x+y);       #fraction of electrons reflected\n",
    "T=1-R;                    #fraction of electrons transmitted\n",
    "\n",
    "#Result\n",
    "print \"fraction of electrons reflected is\",round(R,2)\n",
    "print \"fraction of electrons transmitted is\",round(T,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 12, Page number 231"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fraction of electrons transmitted is 0.4998\n",
      "fraction of electrons reflected is 0.5002\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=0.34;          #energy(eV)\n",
    "E_V0=0.01;       #voltage(eV)\n",
    "\n",
    "#Calculation\n",
    "x=math.sqrt(E);\n",
    "y=math.sqrt(E_V0);\n",
    "T=4*x*y/(x+y)**2;       #fraction of electrons transmitted \n",
    "R=1-T;                  #fraction of electrons reflected\n",
    "\n",
    "#Result\n",
    "print \"fraction of electrons transmitted is\",round(T,4)\n",
    "print \"fraction of electrons reflected is\",round(R,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 13, Page number 232"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "transmission coefficient is 3.27 *10**-9\n",
      "transmission coefficient in 1st case is 7.62 *10**-8\n",
      "transmission coefficient in 2nd case is 1.51 *10**-15\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",
    "E1=1*e;         #energy(J)\n",
    "E2=2*e;         #energy(J)\n",
    "V0=5*e;         #voltage(J)\n",
    "m=9.1*10**-31;        #mass of electron(kg)\n",
    "chi=1.054*10**-34;     \n",
    "a1=10*10**-10;         #potential barrier(m)\n",
    "a2=20*10**-10;         #potential barrier(m)\n",
    "\n",
    "#Calculation\n",
    "beta1=math.sqrt(2*m*(V0-E1)/(chi**2));\n",
    "y1=16*E1*((V0-E1)/(V0**2));\n",
    "T1=y1*math.exp(-2*a1*beta1);     #transmission coefficient\n",
    "beta2=math.sqrt(2*m*(V0-E2)/(chi**2));\n",
    "y2=16*E2*((V0-E2)/(V0**2));\n",
    "T2=y2*math.exp(-2*a1*beta2);     #transmission coefficient in 1st case\n",
    "T3=y2*math.exp(-2*a2*beta2);     #transmission coefficient in 2nd case\n",
    "\n",
    "#Result\n",
    "print \"transmission coefficient is\",round(T1*10**9,2),\"*10**-9\"\n",
    "print \"transmission coefficient in 1st case is\",round(T2*10**8,2),\"*10**-8\"\n",
    "print \"transmission coefficient in 2nd case is\",round(T3*10**15,2),\"*10**-15\""
   ]
  }
 ],
 "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
}
