{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1> Chapter No 4 : Junctions and Interfaces<h1>"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 Page No 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "N_D = 10**17 * 10**6      #in atoms/m^3\n",
      "N_A = 0.5*10**16*10**6      #in atoms/m^3\n",
      "Epsilon_r = 10\n",
      "\n",
      "#CALCULATIONS\n",
      "Epsilon_o = 8.85*10**-12\n",
      "Epsilon = Epsilon_r*Epsilon_o       #in F/m\n",
      "e = 1.602*10**-19          #in C\n",
      "V = 0\n",
      "V_B = 0.7          #in V\n",
      "W1 = math.sqrt( ((2*Epsilon*V_B)/e)*(1/N_A+1/N_D) )       #in m\n",
      "V_o = V_B    #in V\n",
      "V1 = -10          #in V\n",
      "V_B1 = V_o-V1        #in V\n",
      "W = math.sqrt( ((2*Epsilon*V_B1)/e)*(1/N_A+1/N_D) )             #in m\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The junction width in meter when no external voltage is applied is =%.2f X 10^-6' %(W1*(10**6)))\n",
      "print('Junction width in meter with an external voltage of -10V is =%.2f X 10^-6 m' %(W*(10**6)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The junction width in meter when no external voltage is applied is =0.39 X 10^-6\n",
        "Junction width in meter with an external voltage of -10V is =1.54 X 10^-6 m\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4 Page No 208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V = 5        #in V\n",
      "V_Gamma = 0.6        #in V\n",
      "r_F = 12           #in ohm\n",
      "R = 1           #in k ohm\n",
      "\n",
      "#CALCULATIONS\n",
      "R = R * 10**3    #in ohm\n",
      "I_F = (V-V_Gamma)/(R+r_F)    #in A\n",
      "V_F = V_Gamma + (I_F*r_F)  #in V\n",
      "I_F=I_F*10**3 \n",
      "#RESULTS\n",
      "print('The forward diode current is =%.2f mA ' %I_F)\n",
      "print('The diode voltage is =%.2f V ' %V_F)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forward diode current is =4.35 mA \n",
        "The diode voltage is =0.65 V \n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page No 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "n = 4.4*10**22          #total number of Ge atoms/cm^3\n",
      "n_a = 1*10**8           #number of impurity atoms\n",
      "\n",
      "#CALCULATIONS\n",
      "N_A = n/n_a             #in atoms/cm^3\n",
      "N_A = N_A * 10**6       #in atoms/m^3\n",
      "n_i = 2.5*10**13        #in atoms/cm^3\n",
      "n_i = n_i * 10**6       #in atoms/m^3\n",
      "N_D = 10**3 * N_A       #in atoms/m^3\n",
      "V_T = 26*10**-3         #in A\n",
      "V_J = V_T*math.log( (N_A*N_D)/((n_i)**2) )    #in V\n",
      "print('The contact difference of potential  is =%.2f V For a silicon P-N junction ' %V_J)\n",
      "n = 5*10**22\n",
      "N_A = n/n_a      #in atoms/cm^3\n",
      "N_A = N_A * 10**6  #in atoms/m^3\n",
      "N_D = 10**3 * N_A   #in atoms/m^3\n",
      "n_i = 1.5*10**10        #in /cm^3\n",
      "V_J = V_T*math.log(N_A*N_D/n_i**2)      #in V\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "\n",
      "print('The contact difference of potential  is =%.2f V' %V_J)\n",
      "\n",
      "#Note: There is a calculation error to find the value of V_J in the book, so the answer in the book is wrong.\n",
      "\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The contact difference of potential  is =0.33 V For a silicon P-N junction \n",
        "The contact difference of potential  is =1.44 V\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 Page No 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rho_p = 2     #in ohm-cm\n",
      "Rho_n = 1      #in ohm cm\n",
      "q = 1.6*10**-19     #in C\n",
      "n_i = 2.5*10**13  #atoms per cm^3\n",
      "Miu_p = 1800\n",
      "Miu_n = 3800\n",
      "\n",
      "#CALCULATIONS\n",
      "N_A = 1/(Rho_p*q*Miu_p)     #in /cm^3\n",
      "N_D = 1/(Rho_n*q*Miu_n)     #in /cm^3\n",
      "V_T = 26           #in mV\n",
      "V_T= V_T*10**-3         #in V\n",
      "V_J = V_T*math.log((N_A*N_D)/((n_i)**2))   #in V\n",
      "print('The height of the potential energy barrier is =%.2f in V ' %V_J)\n",
      "Miu_p = 500\n",
      "N_A = 1/(Rho_p*q*Miu_p)      #in /cm^3\n",
      "Miu_n = 1300\n",
      "N_D = 1/(Rho_n*q*Miu_n)        #in /cm^3\n",
      "n_i = 1.5*10**10;\n",
      "V_J = V_T*math.log((N_A*N_D)/((n_i)**2))        #in V\n",
      "\n",
      "#RESULTS\n",
      "print('For silicon P-N juction The height of the potential energy barrier  is =%.2f V' %V_J)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The height of the potential energy barrier is =0.22 in V \n",
        "For silicon P-N juction The height of the potential energy barrier  is =0.67 V\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 page No 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Eta = 1\n",
      "V_T = 26       #in mV\n",
      "V_T= V_T*10**-3    #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "V= math.log(1-0.9)*V_T     #in V\n",
      "print(\"The voltage in volts is : %.2f \" %V)\n",
      "V1=0.05     #in V\n",
      "V2= -0.05   #in V\n",
      "ratio= (math.e**(V1/(Eta*V_T))-1)/(math.e**(V2/(Eta*V_T))-1)\n",
      "print(\"The ratio of the current for a forward bias to reverse bias is :  %.2f \" %ratio)\n",
      "\n",
      "# Part (iii)\n",
      "Io= 10  #in \u00b5A\n",
      "Io=Io*10**-3  #in mA\n",
      "#For \n",
      "V=0.1   #in V\n",
      "I = Io * (math.e**(V/(Eta*V_T)) - 1)     #in mA\n",
      "print(\"For v=0.1 V , the value of I  is : %.2f mA \" %I)\n",
      "\n",
      "#For \n",
      "V=0.2      #in V\n",
      "I = Io * (math.e**(V/(Eta*V_T)) - 1)      #in mA\n",
      "print(\"For v=0.2 V , the value of I  is : %.2f  mA \" %I)\n",
      "\n",
      "#For \n",
      "V=0.3  #in V\n",
      "I = Io * (math.e**(V/(Eta*V_T)) - 1)           #in mA\n",
      "\n",
      "#RESULTS\n",
      "\n",
      "I=I*10**-3\n",
      "print(\"For v=0.3 V , the value of I  is : %.2f  mA\" %I)\n",
      "print(\"From three value of I, for small rise in forward voltage, the diode current increase rapidly \")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage in volts is : -0.06 \n",
        "The ratio of the current for a forward bias to reverse bias is :  -6.84 \n",
        "For v=0.1 V , the value of I  is : 0.46 mA \n",
        "For v=0.2 V , the value of I  is : 21.90  mA \n",
        "For v=0.3 V , the value of I  is : 1.03  mA\n",
        "From three value of I, for small rise in forward voltage, the diode current increase rapidly \n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8 Page No 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "# Part (i)\n",
      "T1= 25        #in \u00b0C\n",
      "T2= 80.0      #in \u00b0C\n",
      "\n",
      "#CALCULATIONS\n",
      "# Formula Io2= Io1*2**((T2-T1)/10)\n",
      "AntiFactor= 2**((T2-T1)/10)\n",
      "print('Anticipated factor for Ge is : =%.f  ' %AntiFactor)\n",
      "\n",
      "# Part (ii)\n",
      "T1= 25.0     #in \u00b0C\n",
      "T2= 150.0    #in \u00b0C\n",
      "AntiFactor= 2**((T2-T1)/10)\n",
      "\n",
      "#RESULTS\n",
      "print('Anticipated factor for Ge is : =%.f  ' %AntiFactor)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Anticipated factor for Ge is : =45  \n",
        "Anticipated factor for Ge is : =5793  \n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page No 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I=5.0        #in \u00b5A\n",
      "V=10.0       #in V\n",
      "T1= 0.11     #in \u00b0C^-1\n",
      "T2= 0.07      #in \u00b0C^-1\n",
      "\n",
      "#CALCULATIONS\n",
      "Io= T2*I/T1   #in \u00b5A\n",
      "I_R= I-Io      #in \u00b5A\n",
      "R= V/I_R       #in M\u03a9\n",
      "\n",
      "#RESULTS\n",
      "print('The leakage resistance is : =%.1f M\u03a9 ' %R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The leakage resistance is : =5.5 M\u03a9 \n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 Page No 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "Eta = 1.0\n",
      "T = 125.0   #in \u00b0C\n",
      "T = T + 273   #in K\n",
      "V_T = 8.62 * 10**-5 * 398    #in V\n",
      "I_o = 30      #in \u00b5A\n",
      "\n",
      "#CALCULATIONS\n",
      "I_o= I_o*10**-6    #in A\n",
      "v = 0.2            #in V\n",
      "r_f = (Eta * V_T)/(I_o * math.e**(v/(Eta* V_T)))      #in ohm\n",
      "print('The dynamic resistance in the forward direction  is =%.2f \u03a9 ' %r_f)\n",
      "\n",
      "r_r = (Eta * V_T)/(I_o * math.e**(-v/(Eta* V_T)))   #in ohm\n",
      "r_r=r_r*10**-3\n",
      "print('The dynamic resistance in the forward direction  is =%.2f K\u03a9 ' %r_r)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dynamic resistance in the forward direction  is =3.36 \u03a9 \n",
        "The dynamic resistance in the forward direction  is =389.08 K\u03a9 \n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11 Page No 217"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "epsilon = 16/(36 * math.pi * 10**11)       #in F/cm\n",
      "A = 1 * 10**-2\n",
      "W = 2 * 10**-4\n",
      "\n",
      "#CALCULATIONS\n",
      "C_T = (epsilon * A)/W      #in F\n",
      "C_T=C_T*10**12\n",
      "\n",
      "#RESULTS\n",
      "print('The barrier capacitance is =%.2f pF ' %C_T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The barrier capacitance is =70.74 pF \n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page No 217"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "A = 1.0           #in mm^2\n",
      "A = A * 10**-6    #in m^2\n",
      "N_A = 3 * 10**20    #in atoms/m^3\n",
      "q = 1.6 *10**-19    #in C\n",
      "V_o = 0.2         #in V\n",
      "epsilon_r=16\n",
      "epsilon_o= 8.854*10**-12        #in F/m\n",
      "\n",
      "\n",
      "#CALCULATIONS\n",
      "epsilon=epsilon_r*epsilon_o\n",
      "# Part (a)\n",
      "V=-10    #in V\n",
      "W = math.sqrt(((V_o - V) * 2 * epsilon)/(q * N_A))    #m\n",
      "C_T1 = (epsilon * A)/W           #in F\n",
      "W=W*10**6\n",
      "print('The width of the depletion layer  for an applied reverse voltage of 10V  is =%.2f \u00b5m ' %W)\n",
      "\n",
      "# Part (b)\n",
      "V=-0.1           #in V\n",
      "W = math.sqrt(((V_o - V) * 2 * epsilon)/(q * N_A))         #m\n",
      "C_T2 = (epsilon * A)/W            #in F\n",
      "W=W*10**6\n",
      "print('The width of the depletion layer  for an applied reverse voltage of 0.1V is =%.2f \u00b5m ' %W)\n",
      "\n",
      "# Part (c)\n",
      "V=0.1         #in V\n",
      "W = math.sqrt(((V_o - V) * 2 * epsilon)/(q * N_A))   # m\n",
      "W=W*10**6\n",
      "print('The width of the depletion layer  for an applied reverse voltage of 0.1V is =%.2f \u00b5m ' %W)\n",
      "\n",
      "#Part (d)\n",
      "C_T1=C_T1*10**12\n",
      "C_T2=C_T2*10**12\n",
      "\n",
      "#RESULTS\n",
      "print('The space charge capacitance for an applied reverse voltage of 10V  is =%.2f pF ' %C_T1)\n",
      "print('The space charge capacitance for an applied reverse voltage of 0.1V  is =%.2f  pF' %C_T2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The width of the depletion layer  for an applied reverse voltage of 10V  is =7.76 \u00b5m \n",
        "The width of the depletion layer  for an applied reverse voltage of 0.1V is =1.33 \u00b5m \n",
        "The width of the depletion layer  for an applied reverse voltage of 0.1V is =0.77 \u00b5m \n",
        "The space charge capacitance for an applied reverse voltage of 10V  is =18.26 pF \n",
        "The space charge capacitance for an applied reverse voltage of 0.1V  is =106.46  pF\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 4.13 Page No 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "I_o = 1.8 * 10**-9         #A\n",
      "v = 0.6                 #in V\n",
      "Eta = 2\n",
      "V_T = 26              #in mV\n",
      "\n",
      "#CALCULATIONS\n",
      "V_T=V_T*10**-3      #in V\n",
      "I = I_o *(math.e**(v/(Eta * V_T)))           #in A\n",
      "I=I*10**3\n",
      "\n",
      "#RESULTS\n",
      "print('The current in the junction  is =%.2f mA ' %I)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current in the junction  is =0.18 mA \n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 4.14 Page No 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_o = 2.4 * 10**-14\n",
      "I = 1.5         #in mA\n",
      "I=I*10**-3       #in A\n",
      "Eta = 1\n",
      "V_T = 26           #in mV\n",
      "\n",
      "#CALCULATIONS\n",
      "V_T= V_T*10**-3        #in V\n",
      "v =math.log((I + I_o)/I_o) * V_T          #in V\n",
      "\n",
      "#RESULTS\n",
      "print('The forward biasing voltage across the junction  is =%.2f   V' %v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forward biasing voltage across the junction  is =0.65   V\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 4.15 Page No 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "I_o = 10              #in nA\n",
      "\n",
      "#CALCULATIONS\n",
      "I = I_o * (-1)         #in nA\n",
      "\n",
      "#RESULTS\n",
      "print('The Diode current is  = %.f nA ' %I)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Diode current is  = -10 nA \n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 4.16 Page No 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "R = 4.5   #in ohm\n",
      "I = 44.4       #in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "I=I*10**-3          #in A\n",
      "V = R * I         #in V\n",
      "Eta = 1\n",
      "V_T = 26          #in mV\n",
      "V_T=V_T*10**-3    #in V\n",
      "I_o = I/((math.e**(V/(Eta * V_T))) -1)         #in A\n",
      "V = 0.1         #in V\n",
      "r_f = (Eta * V_T)/(I_o * ((math.e**(V/(Eta * V_T)))-1))        #in ohm\n",
      "\n",
      "#RESULTS\n",
      "print('The diode dynamic resistance is =%.2f  \u03a9' %r_f)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diode dynamic resistance is =27.78  \u03a9\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 4.18 Page No 219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V = 0.25          #in V\n",
      "I_o = 1.2         #in \u00b5A\n",
      "\n",
      "#CALCULATIONS\n",
      "I_o = I_o * 10**-6          #in A\n",
      "V_T = 26                   #in mV\n",
      "V_T = V_T * 10**-3         #in V\n",
      "Eta = 1\n",
      "r = (Eta * V_T)/(I_o * (math.e**(V/(Eta * V_T))))        #in ohm\n",
      "\n",
      "#RESULTS\n",
      "print('The ac resistance of the diode  is =%.2f  \u03a9' %r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ac resistance of the diode  is =1.45  \u03a9\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example No 4.19 Page No 219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "q = 1.6 * 10**-19         #in C\n",
      "N_A = 3 * 10**20          #in /m^3\n",
      "A = 1               #in \u00b5m^2\n",
      "\n",
      "#CALCULATIONS\n",
      "A = A * 10**-6        #in m^2\n",
      "V = -10          #in V\n",
      "V_J = 0.25        #in V\n",
      "V_B = V_J - V        #in V\n",
      "epsilon_o = 8.854       #in pF/m\n",
      "epsilon_o = epsilon_o * 10**-12          #in F/m\n",
      "epsilon_r = 16\n",
      "epsilon = epsilon_o * epsilon_r\n",
      "W = math.sqrt((V_B * 2 * epsilon)/(q * N_A))   #in m \n",
      "\n",
      "#RESULTS\n",
      "C_T = (epsilon * A)/W   #in pF\n",
      "W=W*10**6\n",
      "C_T=C_T*10**12\n",
      "print('The width of depletion layer is =%.2f \u00b5m ' %W)\n",
      "print('The space charge capacitance is =%.2f pF ' %C_T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The width of depletion layer is =7.78 \u00b5m \n",
        "The space charge capacitance is =18.21 pF \n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example No 4.20 Page No 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "C_T = 100.0   #in pF\n",
      "C_T=C_T*10**-12     #in F\n",
      "epsilon_r = 12\n",
      "epsilon_o = 8.854 * 10**-12      #in F/m\n",
      "\n",
      "#CALCULATIONS\n",
      "epsilon = epsilon_r * epsilon_o\n",
      "Rho_p = 5   #in ohm-cm\n",
      "Rho_p = Rho_p * 10**-2         #in ohm-m\n",
      "V_j = 0.5           #in V\n",
      "V = -4.5           #in V\n",
      "Mu_p = 500          #in cm^2\n",
      "Mu_p = Mu_p * 10**-4     #in m^2\n",
      "Sigma_p = 1/Rho_p         #in per ohm-m\n",
      "qN_A = Sigma_p/ Mu_p\n",
      "V_B = V_j - V\n",
      "W = math.sqrt((V_B * 2 * epsilon)/qN_A)\n",
      "A = (C_T * W)/ epsilon             #in m\n",
      "D = math.sqrt(A * (4/math.pi))        #in m\n",
      "D = D * 10**3          #in mm\n",
      "\n",
      "#RESULTS\n",
      "print('The diameter is =%.2f mm ' %D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diameter is =1.40 mm \n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example No 4.21 Page No 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "q = 1.6 * 10**-19         #in C\n",
      "Mu_p = 500         #in cm^2/V-sec\n",
      "Rho_p = 3.5          #in ohm-cm\n",
      "Mu_n = 1500          #in cm^2/V-sec\n",
      "Rho_n = 10          #in ohm-cm\n",
      "\n",
      "#CALCULATIONS\n",
      "N_A = 1/(Rho_p * Mu_p * q)       # in /cm^3\n",
      "N_D = 1/(Rho_n * Mu_n * q)       # in /cm^3\n",
      "V_J = 0.56            # in V\n",
      "n_i = 1.5 * 10**10         #in /cm^3\n",
      "V_T = V_J/math.log((N_A * N_D)/(n_i)**2)     #in V\n",
      "T = V_T * 11600          #in K\n",
      "T = T - 273            #in \u00b0C\n",
      "\n",
      "#RESULTS\n",
      "print('The Temperature of junction is =%.2f \u00b0C ' %T)\n",
      "print('Approximation error')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Temperature of junction is =14.28 \u00b0C \n",
        "Approximation error\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example No 4.22 Page No 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "R = 5       #in ohm\n",
      "I = 50      #in mA\n",
      "I=I*10**-3   #in A\n",
      "V = R * I    #in V\n",
      "Eta = 1\n",
      "V_T = 26    #in mV\n",
      "\n",
      "#CALCULATIONS\n",
      "V_T=V_T*10**-3     #in V\n",
      "I_o = I/((math.e**(V/(Eta * V_T))) - 1)     #in A\n",
      "v1 = 0.2         #in V\n",
      "r = (Eta * V_T)/(I_o * (math.e**(v1/(Eta * V_T))))         #in ohm\n",
      "\n",
      "#RESULTS\n",
      "I_o=I_o*10**6\n",
      "print('Reverse saturation current  is =%.2f \u00b5A ' %I_o)\n",
      "print('Dynamic resistance of the diode is =%.2f \u03a9 ' %r)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reverse saturation current  is =3.33 \u00b5A \n",
        "Dynamic resistance of the diode is =3.56 \u03a9 \n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}