{
 "metadata": {
  "name": "",
  "signature": "sha256:606a5c9e48de665a7bdbd2fe9ec84d0a776a619019e1e88b4d21b1affe9620a0"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:  Junction Properties"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.1 page No. 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t\t    #in Kelvin\n",
      "ND=5*10**13\t\t     #in cm**-3\n",
      "NA=0\t\t\t     #in cm**-3\n",
      "ni=2.4*10**13\t\t#in cm**-3\n",
      "\n",
      "#Calculation\n",
      "no=ND/2.0+math.sqrt((ND/2.0)**2+ni**2)\t#in cm**-3\n",
      "po=ni**2/no\t\t#in cm**-3\n",
      "\n",
      "#Result\n",
      "print\"Majority carrier electron concentration is \",round(no,-11),\"cm**-3\"\n",
      "print\"Minority carrier hole concentration is \",round(po,-11),\" cm**-3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Majority carrier electron concentration is  5.97e+13 cm**-3\n",
        "Minority carrier hole concentration is  9.7e+12  cm**-3\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.2 Page No.146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t\t#in Kelvin\n",
      "ND=10**16\t\t#in cm**-3\n",
      "NA=0\t\t\t #in cm**-3\n",
      "ni=1.5*10**10\t\t#in cm**-3\n",
      "\n",
      "#Calculation\n",
      "no=ND/2.0+math.sqrt((ND/2.0)**2+ni**2)\t#in cm**-3\n",
      "po=ni**2/no\t\t#in cm**-3\n",
      "\n",
      "#result\n",
      "print\"Majority carrier electron concentration is \",no,\"cm**-3\"\n",
      "print\"Minority carrier hole concentration is \",round(po,0),\" cm**-3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Majority carrier electron concentration is  1e+16 cm**-3\n",
        "Minority carrier hole concentration is  22500.0  cm**-3\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.3 Page No. 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t\t#in Kelvin\n",
      "ND=3*10**15\t\t#in cm**-3\n",
      "NA=10**16\t\t#in cm**-3\n",
      "ni=1.6*10**10\t\t#in cm**-3\n",
      "\n",
      "#Calculation\n",
      "po=(NA-ND)/2+math.sqrt(((NA-ND)/2.0)**2+ni**2.0)\t#in cm**-3\n",
      "no=ni**2/po\t\t#in cm**-3\n",
      "\n",
      "#Result\n",
      "print\"Majority carrier hole concentration is\",round(po,-8),\" cm**-3\"\n",
      "print\"Minority carrier electron concentration is \",round(no,0),\" cm**-3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Majority carrier hole concentration is 7e+15  cm**-3\n",
        "Minority carrier electron concentration is  36571.0  cm**-3\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.4 Page No. 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given \n",
      "import math\n",
      "ND=3*10**15\t\t#in cm**-3\n",
      "Eg=1.12             #eV\n",
      "k=8.62*10**-5        #eV/k\n",
      "Nc=2.8*10**19\n",
      "Nv=1.04*10**19\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "# from the equation po=(NA-ND)/2+math.sqrt(((NA-ND)/2.0)**2+ni**2.0)\t#in cm**-3\n",
      "No=1.05*ND\n",
      "ni=math.sqrt((No-ND/2.0)**2-0.25*ND**2)\n",
      "#From ni**2=Nc*Nv*exp(-Eg/(k*t))\n",
      "T=Eg/(-math.log(ni**2/(Nc*Nv))*k)\n",
      "\n",
      "#Result\n",
      "print \"The maximum Temprature is \",round(T,1),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum Temprature is  642.0 K\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.5 Page No. 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t#in Kelvin\n",
      "ND=10**15\t#in cm**-3\n",
      "NA=10**18\t#in cm**-3\n",
      "ni=1.5*10**10\t#in cm**-3\n",
      "VT=T/11600.0\t#in Volts\n",
      "\n",
      "#Calculation\n",
      "Vbi=VT*math.log(NA*ND/ni**2)\t#in Volts\n",
      "\n",
      "#result\n",
      "print\"Built in potential barrier is\",round(Vbi,4),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Built in potential barrier is 0.7532 V\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.6 Page No.151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "T=300\t\t  #in Kelvin\n",
      "ND=10**21\t  #in m**-3\n",
      "NA=10**21\t  #in m**-3\n",
      "ni=1.5*10**16  #in m**-3\n",
      "VT=T/11600.0\t#in Volts\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "Vo=VT*math.log(NA*ND/ni**2)\t#in Volts\n",
      "\n",
      "#result\n",
      "print\"Contact potential is\",round(Vo,4),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Contact potential is 0.5745 V\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.7 Page No. 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t\t#in Kelvin\n",
      "ND=10**15\t\t#in cm**-3\n",
      "NA=10**16\t\t#in cm**-3\n",
      "ni=1.5*10**10\t\t#in cm**-3\n",
      "VT=T/11600.0\t\t#in Volts\n",
      "e=1.6*10**-19\t   #in Coulamb\n",
      "\n",
      "#calculation\n",
      "epsilon=11.7*8.854*10**-14\t      #constant\n",
      "Vbi=VT*math.log(NA*ND/ni**2)\t\t#in Volts\n",
      "SCW=math.sqrt((2*epsilon*Vbi/e)*(NA+ND)/(NA*ND))#in cm\n",
      "SCW=SCW*10**4   #in uMeter\n",
      "xn=0.864\t\t#in uM\n",
      "xp=0.086\t\t#in uM\n",
      "Emax=-e*ND*xn/epsilon\t#in V/cm\n",
      "\n",
      "#result\n",
      "print\"Space charge width is\",round(SCW,2),\"micro meter\"\n",
      "print\"At metallurgical junction, i.e for x=0 the electric field is \",round(Emax/10000,0),\"V\"#Note : Ans in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Space charge width is 0.95 micro meter\n",
        "At metallurgical junction, i.e for x=0 the electric field is  -13345.0 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.8 Page No.160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "import math\n",
      "Ecf=0.3               #in Volts\n",
      "T=27.0+273.0              #in Kelvin\n",
      "delT=55               #in degree centigrade\n",
      "\n",
      "#calculation\n",
      "#formula : Ecf=Ec-Ef=K*T*math.log(nc/ND)\n",
      "#let K*math.log(nc/ND)=y\n",
      "#Ecf=Ec-Ef=T*y\n",
      "y=Ecf/T               #assumed\n",
      "Tnew=273+55           #in Kelvin\n",
      "EcfNEW=y*Tnew         #in Volts\n",
      "\n",
      "#result\n",
      "print\"New position of fermi level is \",round(EcfNEW,4),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "New position of fermi level is  0.328 V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.9 Page No. 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      " \n",
      "#given data\n",
      "import math\n",
      "T=300\t\t\t#in Kelvin\n",
      "ND=8*10**14\t\t#in cm**-3\n",
      "NA=8*10**14\t\t#in cm**-3\n",
      "ni=2*10**13\t\t#in cm**-3\n",
      "k=8.61*10**-5\t\t#in eV/K\n",
      "\n",
      "#calculation\n",
      "Vo=k*T*math.log(NA*ND/ni**2)\t#in Volts\n",
      "\n",
      "#Result\n",
      "print\"Contact potential is \",round(Vo,2),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Contact potential is  0.19 V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.10 page No.161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "ND=2*10**16          #in cm**-3\n",
      "NA=5*10**15          #in cm**-3\n",
      "Ao=4.83*10**21   \t#constant\n",
      "T=300.0\t\t\t    #in Kelvin\n",
      "EG=1.1\t \t  \t    #in eV\n",
      "kT=0.026     \t\t#in eV\n",
      "\n",
      "#Calculation\n",
      "ni=Ao*T**(1.5)*math.exp(-EG/(2*kT))\t\t#in m**-3\n",
      "p=(ni/10**6)**2/ND\t\t\t#in cm**-3\n",
      "n=((ni/10**6)**2)/NA\t\t\t#in cm**-3\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"Hole concentration in cm**-3 : %.1e\"%round(p,0),\"/cm**3\"\n",
      "print\"electron concentration in cm**-3 :%.1e\"%round(n,0),\"/cm**3\"\n",
      "print\"\\nNOTE:\\nSlight Variation in answer due to wrong value of ni in book as 1.6*10**16 instead of\",ni\n",
      "if n < e:\n",
      "    \n",
      "    print\"\\n\\nthe given Si is of P-type\" \n",
      "else:\n",
      "    print \"\\nThe given Si is of N-type\"\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hole concentration in cm**-3 : 1.3e+04 /cm**3\n",
        "electron concentration in cm**-3 :5.3e+04 /cm**3\n",
        "\n",
        "NOTE:\n",
        "Slight Variation in answer due to wrong value of ni in book as 1.6*10**16 instead of 1.63166259315e+16\n",
        "\n",
        "The given Si is of N-type\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.11 Page No. 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "V=5\t\t  #in volts\n",
      "Vo=0.7\t   #in Volts\n",
      "R=100\t\t#in Kohm\n",
      "\n",
      "#Calculation\n",
      "I=(V-Vo)/R\t#in Ampere\n",
      "\n",
      "#result\n",
      "print\"Current flowing through the circuit is\",round(I*1000,0),\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current flowing through the circuit is 43.0 mA\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.12 Page No. 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "V=15\t\t\t  #in volts\n",
      "Vo=0.7\t\t\t#in Volts\n",
      "R=7\t  \t \t#in Kohm\n",
      "\n",
      "#Calculation\n",
      "I=(V-2*Vo)/R\n",
      "I=(V-2*Vo)/R\t\t#in mAmpere\n",
      "VA=I*R\t  \t\t#in Volts\n",
      "\n",
      "#result\n",
      "print\"Voltagee VA is \",VA,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltagee VA is  13.6 V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.13 Page No.169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "V=15       #V, voltage\n",
      "Vb=0.3     #V, Barrier Potential #When supply is switched on\n",
      "\n",
      "#Calculation\n",
      "VA=V-Vb\n",
      "\n",
      "#Result\n",
      "print\"The Voltage VA is \",VA,\"V\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Voltage VA is  14.7 V\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.14 Page No.172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "Vz=5\t\t\t#in volts\n",
      "to=25\t\t\t#in degree centigrade\n",
      "t=100\t\t\t#in degree centigrade\n",
      "Vdrop=4.8\t\t#in Volts\n",
      "\n",
      "#calculation\n",
      "delVz=Vdrop-Vz\t\t#in Volts\n",
      "delt=t-to\t\t#in degree centigrade\n",
      "TempCoeff=delVz*100/(Vz*delt)\n",
      "\n",
      "#result\n",
      "print\"Temperature coefficient f zener diode is \",round(TempCoeff,3),\"percent\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature coefficient f zener diode is  -0.053 percent\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.15 Page No. 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "Vz=8.0\t\t\t#in volts\n",
      "VS=12.0\t\t\t#in volts\n",
      "RL=10.0\t\t\t#in Kohm\n",
      "Rs=5.0\t\t\t#in Kohm\n",
      "\n",
      "#part (a)\n",
      "Vout=Vz\t\t\t#in volts\n",
      "\n",
      "#part (b)\n",
      "Vrs=VS-Vout\t\t#in volts\n",
      "IL=Vout/RL \t\t#in mAmpere\n",
      "Is=(VS-Vout)/Rs\t#in mAmpere\n",
      "\n",
      "#part c\n",
      "Iz=Is-IL\t   \t#in mAmpere\n",
      "\n",
      "#result\n",
      "print\"(a)Output voltage will be equal to Vout=\",Vout,\" Volts\"\n",
      "print\"(b)Voltage across Rs is Rs=\",Vrs,\"V\"\n",
      "print\"(c)Current through zener diode is Iz=\",round(Iz,1),\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Output voltage will be equal to Vout= 8.0  Volts\n",
        "(b)Voltage across Rs is Rs= 4.0 V\n",
        "(c)Current through zener diode is Iz= 0.0 mA\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.16 Page No. 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#given data\n",
      "Vz=50.\t\t\t#in volts\n",
      "VSmax=120.0\t\t#in volts\n",
      "VSmin=80.0\t\t#in volts\n",
      "RL=10.0\t\t\t#in Kohm\n",
      "Rs=5.0\t\t\t#in Kohm\n",
      "\n",
      "#Calculation\n",
      "Vout=Vz\t\t\t#in Volts\n",
      "IL=Vout/RL\t\t#in mAmpere\n",
      "\n",
      "ISmax=(VSmax-Vout)/Rs\t#in mAmpere\n",
      "Izmax=ISmax-IL\t\t#in mA\n",
      "Ismin=(VSmin-Vout)/Rs#in mAmpere\n",
      "Izmin=Ismin-IL#in mA\n",
      "\n",
      "#Result\n",
      "print\"Maximum zener diode current is \",Izmax,\"mA\"\n",
      "print\"Minimum zener diode current is \",Izmin,\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum zener diode current is  9.0 mA\n",
        "Minimum zener diode current is  1.0 mA\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.17 Page No. 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "Vz=15\t\t#in volts\n",
      "Izk=6.0\t\t#in mA\n",
      "Vout=15\t\t#in Volts\n",
      "Vs=20\t\t#in Volts\n",
      "ILmin=10.0\t#in mA\n",
      "ILmax=20.0\t#in mA\n",
      "RS=(Vs-Vz)*1000/(ILmax+Izk)\t#in ohm\n",
      "\n",
      "#result\n",
      "print\"sereis Resistance is \",round(RS,1),\"ohm\"\n",
      "print\"The zener current will be minimum i.e. Izk = 6mA when load current is maximum i.e. ILmax = 20mA\"\n",
      "print\"when the load current will decrease and become 10 mA, the zener current will increase and become 6+10 i.e. 16 mA. \\nThus the current through series resistance Rs will remain unchanged at 6+20 i.e. 26 mA. \\nThus voltage drop in series resistance Rs will remain constant. Consequently, the output voltage will also remain constant. \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sereis Resistance is  192.3 ohm\n",
        "The zener current will be minimum i.e. Izk = 6mA when load current is maximum i.e. ILmax = 20mA\n",
        "when the load current will decrease and become 10 mA, the zener current will increase and become 6+10 i.e. 16 mA. \n",
        "Thus the current through series resistance Rs will remain unchanged at 6+20 i.e. 26 mA. \n",
        "Thus voltage drop in series resistance Rs will remain constant. Consequently, the output voltage will also remain constant. \n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.18 Page No. 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "Vs=16.0\t\t   #in volts\n",
      "RL=1.2\t\t\t#in Kohm\n",
      "Rs=1.0\t\t\t#in Kohm\n",
      "\n",
      "#calculation\n",
      "#If zener open circuited\n",
      "VL=Vs*RL/(Rs+RL)\t#in Volts\n",
      "Iz=0\t\t\t#in mA\n",
      "Pz=VL*Iz\t\t#in watts\n",
      "\n",
      "#result\n",
      "print\"When zener open circuited Voltage across load is \",round(VL,2),\"V\"\n",
      "print\"Zener current is \",Iz,\"mA\"\n",
      "print\"Power is\",Pz,\"watt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When zener open circuited Voltage across load is  8.73 V\n",
        "Zener current is  0 mA\n",
        "Power is 0.0 watt\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.19 Page No. 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "Vin=20\t\t\t#in volts\n",
      "Rs=220.0\t\t\t#in Kohm\n",
      "Vz=10\t\t \t#in volts\n",
      "RL2=50.0\t\t\t#in Kohm\n",
      "RL1=200\t\t\t#in Kohm\n",
      "\n",
      "#calculation\n",
      "# part (i) RL=50\t#in Kohm\n",
      "VL1=Vin*RL1/(RL+Rs)\n",
      "IR=Vin/(Rs+RL)\t#in mA\n",
      "IL=IR\t\t \t#in mA\n",
      "IZ=0\t\t\t  #in mA\n",
      "\n",
      "if VL1< Vz:\n",
      "    \n",
      "    print\"Zener diode will not conduct and VL=\",round(VL1,1),\"V\" \n",
      "else:\n",
      "    print \"Zener diode will conduct\"\n",
      "\n",
      "    \n",
      "#Result\n",
      "print\"When RL=200 ohm\"\n",
      "print\"IL is\",round(IL*1000,2),\"mA\"\n",
      "print\"IR is\",round(IR*10**3,2),\"mA\"\n",
      "print\"Iz in mA: \",round(IZ,0),\"mA\"\n",
      "\n",
      "# part (ii) RL=200#in Kohm\n",
      "RL=200\t\t\t#in Kohm\n",
      "VL2=Vin*RL2/(RL2+Rs)\n",
      "IR=Vin/(Rs+RL2)\t\t#in mA\n",
      "IL=IR\t\t\t#in mA\n",
      "IZ=0\t\t\t#in mA\n",
      "\n",
      "#result\n",
      "if VL2< Vz:\n",
      "    \n",
      "    print\"Zener diode will not conduct and VL=\",round(VL2,1),\"V\" \n",
      "else:\n",
      "    print \"Zener diode will conduct\"\n",
      "\n",
      "print\"When RL=50 ohm\"\n",
      "print\"IL is\",round(IL*1000,2),\"mA\"\n",
      "print\"IR is\",round(IR*10**3,2),\"mA\"\n",
      "print\"Iz in mA: \",IZ,\"mA\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Zener diode will not conduct and VL= 9.5 V\n",
        "When RL=200 ohm\n",
        "IL is 47.62 mA\n",
        "IR is 47.62 mA\n",
        "Iz in mA:  0.0 mA\n",
        "Zener diode will not conduct and VL= 3.7 V\n",
        "When RL=50 ohm\n",
        "IL is 74.07 mA\n",
        "IR is 74.07 mA\n",
        "Iz in mA:  0 mA\n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.20 Page No. 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "RL=10.0\t\t\t  #in Kohm\n",
      "Rs=5.0               #in Kohm\n",
      "Vin=100\t\t\t  #in Volts\n",
      "\n",
      "#Calculation\n",
      "V=Vin*RL/(RL+Rs)\t#in Volt\n",
      "VZ=50\t\t\t#in Volts\n",
      "VL=VZ\t\t\t#in volts\n",
      "#Apply KVL\n",
      "VR=100-50\t\t#in Volts\n",
      "VR=50\t\t\t#in Volts\n",
      "\n",
      "if V< VZ:\n",
      "    \n",
      "    print\"Zener diode is OFF state\" \n",
      "else:\n",
      "    print \"zener diode is ON state\"\n",
      "\n",
      "print\"Hence the voltage dropp across the 5 Kohm resistor in Volts is \",VR,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "zener diode is ON state\n",
        "Hence the voltage dropp across the 5 Kohm resistor in Volts is  50 V\n"
       ]
      }
     ],
     "prompt_number": 67
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.21 Page No. 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "RL=120.0\t\t\t#in ohm, load resistance\n",
      "Izmin=20\t\t#in mA min. diode current\n",
      "Izmax=200\t\t#in mA max. diode current\n",
      "VL=12\t\t\t#in Volts\n",
      "VDCmin=15\t\t#in Volts\n",
      "VDCmax=19.5\t\t#in Volts\n",
      "Vz=12\t\t\t#in Volts\n",
      "IL=VL/RL\t\t#in Ampere\n",
      "IL=IL*1000\t\t#in mAmpere\n",
      "\n",
      "#calculation\n",
      "#For VDCmin = 15 volts\n",
      "VSmin=VDCmin-Vz\t\t#in Volts\n",
      "#For VDCmax = 19.5 volts\n",
      "VSmax=VDCmax-Vz\t\t#in Volts\n",
      "ISmin=Izmin+IL\t\t#in mA\n",
      "Ri=VSmin/ISmin\t\t#in Kohm\n",
      "Ri=Ri*10**3\t\t#in ohm\n",
      "\n",
      "#result\n",
      "print\"The resistance Ri is \",Ri,\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance Ri is  25.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 72
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.22 Page No. 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "VRL=10\t\t\t#in Volts  Diode resistance\n",
      "Vi=50\t\t\t#in Volts\n",
      "R=1.0\t\t\t#in Kohm  Resistance\n",
      "Vz=10\t\t\t#in Volts\n",
      "VL=Vz\t\t\t#in Volts\n",
      "Izm=32\t\t\t#in mA\n",
      "IR=(Vi-VL)/R\t\t#in mA\n",
      "\n",
      "Izmin=0\t\t\t   #in mA\n",
      "ILmax=IR-Izmin\t\t#in mA\n",
      "RLmin=VL/ILmax\t\t#in Ohm\n",
      "Izmax=32\t\t      #in mA\n",
      "ILmin=IR-Izmax\t\t#in mA\n",
      "VL=Vz\t\t\t     #in Volts\n",
      "RLmax=VL/ILmin\t\t#in Ohm\n",
      "\n",
      "#Result\n",
      "print\"Range of RL in Kohm : From \",RLmin*1000,\"ohm to \",RLmax,\"kohm\"\n",
      "print\"Range of IL in mA : From \",ILmin,\"mA to \",ILmax,\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Range of RL in Kohm : From  250.0 ohm to  1.25 kohm\n",
        "Range of IL in mA : From  8.0 mA to  40.0 mA\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}