{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction to Solid State Electronics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1, Page No. 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# ne in the doped silicon\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "ni=1.5*10**16               # in m^-3\n",
      "nh=4.5*10**22               # in m^-3\n",
      "\n",
      "#Calculations\n",
      "ne=ni**2/nh\n",
      "\n",
      "#Result\n",
      "print(\" ne in the doped silicon is,(m^-3) = %.f * 10^9\"%(ne/10**9))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " ne in the doped silicon is,(m^-3) = 5 * 10^9\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2, Page No. 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "ne=8.0*10**19                # in m^-3\n",
      "nh=5.0*10**18                # in m^-3\n",
      "mu_e=2.3                     # in m^2/V-s\n",
      "mu_h=.01                     # in m^2/V-s\n",
      "e=1.6*10**-19                # in V\n",
      "\n",
      "#Calculations\n",
      "p=1/(e*((ne*mu_e)+(nh*mu_h)));\n",
      "\n",
      "#Result\n",
      "print(\"(b) the resistivity,p(ohm-m)= %.1f * 10^-2\"%(p*10**2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(b) the resistivity,p(ohm-m)= 3.4 * 10^-2\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3, Page No. 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Density\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "sigma=500.0              # in ohm^-1 m^-1\n",
      "mu_e=0.39                # m^2/V-s\n",
      "e=1.6*10**-19            # in V\n",
      "\n",
      "#Calculations\n",
      "ne=sigma/(e*mu_e);\n",
      "\n",
      "#Result\n",
      "print(\"number density of donor,ne(m^-3) = %.2f * 10^21\"%(ne*10**-21))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "number density of donor,ne(m^-3) = 8.01 * 10^21\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4, Page No. 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Density\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "e=1.6*10**-19          # in V\n",
      "Pp=10**-2              # p-type silicon in ohm-m\n",
      "Pn=10**-2              # n-type silicon in ohm-m\n",
      "mu_p=0.048             # holes mobilities in m^2/V-s\n",
      "mu_n=0.135             # electrons mobilities in m^2/V-s\n",
      "\n",
      "#Calculations\n",
      "Na=1/(e*mu_p*Pp);\n",
      "Nd=1/(e*mu_n*Pn);\n",
      "\n",
      "#Result\n",
      "print(\"(i).  the density of impurity,Na (m^-3) = %.1f * 10^22\"%(Na*10**-22))\n",
      "print(\"(ii). the density of impurity,Nd (m^-3) = %.2f * 10^21\"%(Nd*10**-21))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i).  the density of impurity,Na (m^-3) = 1.3 * 10^22\n",
        "(ii). the density of impurity,Nd (m^-3) = 4.63 * 10^21\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5, Page No. 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Resistivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19                 # in V\n",
      "n=2.5*10**19                  # m^3\n",
      "p=n\n",
      "ni=n\n",
      "mu_p=0.17                     # holes mobilities in m^2/V-s\n",
      "mu_n=0.36                     # electrons mobilities in m^2/V-s\n",
      "\n",
      "#Calculations\n",
      "sgint=e*(ni*(mu_p+mu_n))      #electrical conductivity in mho/metre\n",
      "pint=1/sgint                  #resistivity in ohm-meter\n",
      "print(\"electrical conductivity is ,(mho/metre)= %.2f\"%sgint)\n",
      "print(\"resistivity is ,(ohm-metre)= %.2f\"%pint)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "electrical conductivity is ,(mho/metre)= 2.12\n",
        "resistivity is ,(ohm-metre)= 0.47\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6, Page No. 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "e=1.6*10**-19            # in V\n",
      "ni=1.5*10**16            # in m^3\n",
      "mu_p=0.13                # holes mobilities in m^2/V-s\n",
      "mu_n=0.05                # electrons mobilities in m^2/V-s\n",
      "siat=10.0**8             # number of silicon atoms\n",
      "ta=5.0*10**28            # silicon atoms in atoms/m^3\n",
      "mu_n2=0.13                # electrons mobilities in m^2/V-s\n",
      "siat2=10.0**8            # number of silicon atoms\n",
      "ta2=5.0*10**28           # silicon atoms in atoms/m^3\n",
      "mu_p2=0.05                # holes mobilities in m^2/V-s\n",
      "\n",
      "#Calculations\n",
      "sgint=e*(ni*(mu_p+mu_n)) # electrical conductivity in mho/m\n",
      "Nd=ta/siat               # in atoms/m^3\n",
      "p= ni**2/Nd              # holes concentration in holes/m^3\n",
      "n=Nd\n",
      "sntype=e*n*mu_n2          # in mho/m\n",
      "Na=ta2/siat2               # in atoms/m^3\n",
      "n= ni**2/Na              # holes concentration in holes/m^3\n",
      "sptype=e*Na*mu_p2          # in mho/m\n",
      "\n",
      "#Calculations\n",
      "print(\"(i) electrical conductivity is ,(mhos/m)    = %.2f * 10^-4\"%(sgint*10**4))\n",
      "print(\"(ii) holes concentration is, (holes/m^3)    = %.1f *10^11\"%(p*10**-11))\n",
      "print(\"(ii) conductivity is ,(mho/m)               = %.1f\"%sntype)\n",
      "print(\"(iii) electron concentration is, (holes/m^3)= %.1f * 10^11\"%(n/10**11))\n",
      "print(\"(iii) conductivity is ,(mho/m)              = %.1f\"%sptype)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) electrical conductivity is ,(mhos/m)    = 4.32 * 10^-4\n",
        "(ii) holes concentration is, (holes/m^3)    = 4.5 *10^11\n",
        "(ii) conductivity is ,(mho/m)               = 10.4\n",
        "(iii) electron concentration is, (holes/m^3)= 4.5 * 10^11\n",
        "(iii) conductivity is ,(mho/m)              = 4.0\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7, Page No. 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi Level\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "#Nd1=Nc*exp^-(Ec-Ef1)/kT ...Formula Used\n",
      "Nc=1.0               #assume\n",
      "kT=0.03              #eV\n",
      "EcEf1=0.5            #position of Fermi level in V\n",
      "Nd=1.0               #assume\n",
      "Nd1=3*Nd             #After tripling the donor concentration\n",
      "\n",
      "#Calculation\n",
      "EcEf2=(EcEf1-(kT*(math.log(Nd1/Nd))))\n",
      "print(\"new position of Fermi-level is %.3f eV below conduction band\"%(math.ceil(EcEf2*1000)/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "new position of Fermi-level is 0.468 eV below conduction band\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8, Page No. 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# density\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19           # in V\n",
      "Pp=10**-1               # p-type silicon in ohm-m\n",
      "Pn=10**-1               # n-type silicon in ohm-m\n",
      "mu_h=0.05               # holes mobilities in m^2/V-s\n",
      "mu_e=0.13               # electrons mobilities in m^2/V-s\n",
      "\n",
      "#Calculations\n",
      "Na=1/(e*mu_h*Pp);\n",
      "Nd=1/(e*mu_e*Pn);\n",
      "\n",
      "#Result\n",
      "print(\"(i).  the density of impurity,Na (m^-3) = %.2f * 10^21\"%(Na/10**21))\n",
      "print(\"(ii). the density of impurity,Nd (m^-3) = %.1f * 10^20\"%(Nd/10**20))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i).  the density of impurity,Na (m^-3) = 1.25 * 10^21\n",
        "(ii). the density of impurity,Nd (m^-3) = 4.8 * 10^20\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9, Page No. 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19              # in V\n",
      "Pp=10**-1                  # p-type silicon in ohm-m\n",
      "Pn=10**-1                  # n-type silicon in ohm-m\n",
      "mu_hsi=0.048               # holes mobilities in m^2/V-s\n",
      "mu_esi=0.135               # electrons mobilities in m^2/V-s\n",
      "nisi=1.5*10**16            # in m^-3\n",
      "nesi=nisi\n",
      "nhsi=nisi\n",
      "mu_hge=0.19                # holes mobilities in m^2/V-s\n",
      "mu_ege=0.39                # electrons mobilities in m^2/V-s\n",
      "A=1*10**-4                 # area in m^2\n",
      "nige=2.4*10**19            # in m^-3\n",
      "V=2.0                      # in V\n",
      "l=0.1                      # in m\n",
      "\n",
      "#Calculations\n",
      "Isi= e*A*(V/l)*((nesi*mu_esi)+(nhsi*mu_hsi))\n",
      "#Current for silicon is calculated wrong in the textbook\n",
      "nege=nige\n",
      "nhge=nige\n",
      "Ige= e*A*(V/l)*((nege*mu_ege)+(nhge*mu_hge))\n",
      "\n",
      "#Result\n",
      "print(\"Total current for silicon is,(A)  = %f\"%Isi)\n",
      "print(\"Total current for germanium is,(A)= %.2f * 10^-3\"%(math.ceil(Ige*10**5)/100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total current for silicon is,(A)  = 0.000001\n",
        "Total current for germanium is,(A)= 4.46 * 10^-3\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10, Page No. 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# hole concentration and conductivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "nh=2*10**21       # acceptor atoms in atoms/m^3\n",
      "mu_h=0.17        # mobility of holes in m^2/V-s\n",
      "e=1.6*10**-19    # in C\n",
      "\n",
      "#Calculations\n",
      "Na=nh\n",
      "sigma=nh*mu_h*e;\n",
      "\n",
      "#Result\n",
      "print(\"hole concentration,Na(atoms/m^3) = %.1f * 10^21\"%(Na/10**21))\n",
      "print(\"conductivity,(ohm^-1-m^-1)       = %.1f\"%sigma)\n",
      "#conductivity is calculated wrong in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hole concentration,Na(atoms/m^3) = 2.0 * 10^21\n",
        "conductivity,(ohm^-1-m^-1)       = 54.4\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11, Page No. 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# donor concentration\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "p=0.15                  # in ohm-m\n",
      "mu_e=0.39               # mobility of electron in m^2/V-s\n",
      "e=1.6*10**-19           # in C\n",
      "\n",
      "#Calculations\n",
      "Na=1/(e*mu_e*p);\n",
      "\n",
      "#Result\n",
      "print(\"The value of donor concentration,Na(m^-3) = %.2f * 10^20\"%(Na/10**20))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of donor concentration,Na(m^-3) = 1.07 * 10^20\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.12, Page No. 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistivity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "mu_n=0.13            # in m^2/V-s\n",
      "mu_p=0.05            # in m^2/V-s\n",
      "ni=1.5*10**16        # in m^-3\n",
      "e=1.6*10**-19        # in C\n",
      "\n",
      "#Calculations\n",
      "p=1/((e*ni)*(mu_n+mu_p));\n",
      "\n",
      "#Result\n",
      "print(\"The resistivity,p(ohm-m) = %.1f\"%p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistivity,p(ohm-m) = 2314.8\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.13, Page No. 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19             # electron charge in coulombs\n",
      "k=1.38*10**-23            # Boltzmann constant in m^2-kg/s^2-K^-1\n",
      "T=300.0                   # in Kelvin\n",
      "I=240.0                   # in mA\n",
      "eta=2.0\n",
      "Ve=0.8                    # in V\n",
      "V=0.7                     # in V\n",
      "\n",
      "\n",
      "#Calculations\n",
      "Vt=(k*T)/e                # in V\n",
      "Id=I*math.e**((V-Ve)/(eta*Vt)) #in mA\n",
      "Ir=(I/((math.e**(Ve/(eta*Vt)))-1))*10**6\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"(i)  Current is ,(mA) = %.f\"%(round(Id)))\n",
      "print(\"(ii) reverse saturation current is ,(nA) = %.f\"%(round(Ir)))\n",
      "#reverse saturation current is calculated wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Current is ,(mA) = 35\n",
        "(ii) reverse saturation current is ,(nA) = 46\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.14, Page No. 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# diode current and voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19             # electron charge in coulombs\n",
      "k=1.38*10**-23            # Boltzmann constant in m^2-kg/s^2-K^-1\n",
      "T=300.0                   # in Kelvin\n",
      "Ir1=10**-10               # in A\n",
      "Ir2=10**-12               # in A \n",
      "V211=0.5                  # in V\n",
      "\n",
      "#Calculations\n",
      "Vt=(k*T)/e\n",
      "Vt = math.ceil(Vt*1000)/1000\n",
      "V21=((Vt)*math.log10(Ir1/Ir2))*2.3026\n",
      "V21 = math.floor(V21*10000)/10000\n",
      "V2=(1.0/2)*(V21+V211)\n",
      "V1=(1.0/2)*(V211-V21)\n",
      "I1=Ir2*math.e**(V2/Vt)*10**6\n",
      "I2=I1\n",
      "\n",
      "#Result\n",
      "print(\"diode voltage V2 is ,(V)   = %.5f\"%V2)\n",
      "print(\"diode voltage V1 is ,(V)   = %.5f\"%V1)\n",
      "print(\"diode current is,(micro-A) = %.4f\"%I1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diode voltage V2 is ,(V)   = 0.30985\n",
        "diode voltage V1 is ,(V)   = 0.19015\n",
        "diode current is,(micro-A) = 0.1498\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.15, Page No. 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19             # electron charge in coulombs\n",
      "k=1.38*10**-23            # Boltzmann constant in m^2-kg/s^2-K^-1\n",
      "T=300.0                   # in Kelvin\n",
      "Ir1=10**-12               # in A\n",
      "Ir2=10**-10               # in A\n",
      "It=2.0                    #  mA\n",
      "\n",
      "#Calculations\n",
      "I21=Ir2/Ir1\n",
      "Vt=(k*T)/e                # in V\n",
      "Vt = math.ceil(Vt*1000)/1000\n",
      "I1=It/(1+I21)*10**3       # in micro-A\n",
      "I2=It*10**3-I1            # in micro-A\n",
      "I1=I2/I21                 # in micro-A\n",
      "x=((I1*10**-6)/Ir1)\n",
      "V=Vt*math.log10(x)*2.3026\n",
      "\n",
      "#Result\n",
      "print(\"diode voltage is ,(V) = %.3f\"%V)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diode voltage is ,(V) = 0.437\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.16, Page No. 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "T=27.0              # degree Celsius\n",
      "Tk=273+T            # in Kelvin\n",
      "e=1.6*10**-19       # electron charge in coulombs\n",
      "k=1.38*10**-23      # Boltzmann constant in m^2-kg/s^2-K^-1\n",
      "J=10**4             # in Amp/m^2\n",
      "Jo=200.0            #in mA/m^2\n",
      "\n",
      "#Calculations\n",
      "x=(J/(Jo*10**-3))\n",
      "Ve=((math.log(x))*k*Tk)/e\n",
      "\n",
      "#Result\n",
      "print(\"voltage to be applied is ,(V) = %.2f\"%Ve)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage to be applied is ,(V) = 0.28\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.17, Page No. 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "V=3.0                    # in V\n",
      "I=55.0                   # in mA\n",
      "V2=26.0                  # in mV\n",
      "\n",
      "\n",
      "#Calculations\n",
      "Rdc=V/(I*10**-3)         # in ohm\n",
      "Rac=V2/I                 # in ohm\n",
      "\n",
      "#Result\n",
      "print(\"static resistance is ,(ohm) = %.1f\"%Rdc)\n",
      "print(\"dynamic resistance is ,(ohm) = %.2f\"%Rac)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "static resistance is ,(ohm) = 54.5\n",
        "dynamic resistance is ,(ohm) = 0.47\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.18, Page No. 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "k=1.38*10**-23            # constant\n",
      "T=27+273.0                # in K\n",
      "eta=2.0\n",
      "e=1.6*10**-19             # in C\n",
      "Vt=(k*T/e)                # in V\n",
      "V=0.5                     # in V\n",
      "Ir=10**-6                 # in A\n",
      "\n",
      "#Calculations\n",
      "I=(Ir*10**3*(math.e**(V/(eta*Vt))-1))\n",
      "R_dc=V*10**3/I;\n",
      "R_ac=(eta*k*T)/(e*I*10**-3);\n",
      "\n",
      "#Result\n",
      "print(\"static resistance,R_dc(ohm) = %.1f\"%R_dc)\n",
      "print(\"Dynamic resistance,R_ac(ohm) = %.1f\"%R_ac)\n",
      "#answer is wrong in textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "static resistance,R_dc(ohm) = 31.8\n",
        "Dynamic resistance,R_ac(ohm) = 3.3\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.19, Page No. 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "V=1.2                       # in V\n",
      "Vk=0.7                      # in V\n",
      "I_F=100.0                   # in mA\n",
      "V_R=10.0                    # in V\n",
      "I_R=1.0                     # in micro-A\n",
      "I=5.0                       # in  mA\n",
      "eta=2\n",
      "\n",
      "#Calculations\n",
      "R_B=(V-Vk)/(I_F*10**-3)\n",
      "R_R=V_R/I_R\n",
      "R_ac=eta*26/I\n",
      "\n",
      "#Result\n",
      "print(\"the bulk resistance,R_B(ohm)      = %.f\"%R_B)\n",
      "print(\"the reverse resistance,R_R(M-ohm) = %.f\"%R_R)\n",
      "print(\"ac resistance,R_ac(ohm)           = %.1f\"%R_ac)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the bulk resistance,R_B(ohm)      = 5\n",
        "the reverse resistance,R_R(M-ohm) = 10\n",
        "ac resistance,R_ac(ohm)           = 10.4\n"
       ]
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.20, Page No. 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# capacitance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "epsilon_0=8.85*10**-12          # in farada/m\n",
      "K=12.0                          # constant for silicon\n",
      "A=1*10**-8                      # in m^2\n",
      "W=5*10**-7                      # in m\n",
      "\n",
      "#Calculations\n",
      "epsilon=epsilon_0*K\n",
      "Ct=epsilon*A*10**14/W;\n",
      "\n",
      "#Result\n",
      "print(\"the transition capacitance,Ct(PF)  = %.1f\"%Ct)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the transition capacitance,Ct(PF)  = 212.4\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.21, Page No. 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "V=0.2              # in V\n",
      "I=1.0              # in micro-A\n",
      "\n",
      "#Calculations\n",
      "R_dc=V*10**3/I\n",
      "R_ac=26/(I*10**3);\n",
      "\n",
      "#Result\n",
      "print(\"The static resistance,R_ac(k-ohm) = %.f\"%R_dc)\n",
      "print(\"the dynamic resistance,R_ac(ohm)  = %.3f\"%R_ac)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The static resistance,R_ac(k-ohm) = 200\n",
        "the dynamic resistance,R_ac(ohm)  = 0.026\n"
       ]
      }
     ],
     "prompt_number": 55
    }
   ],
   "metadata": {}
  }
 ]
}