{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4 , Junction Diode"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.1 , Page Number 103 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current flowing through Germanium diode is  15.0  micro-A.\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "Io = 0.15 * 10**-6                 #Peak reverse biased current (in Ampere)\n",
    "V = 0.12                           #Voltage (in volts)\n",
    "VT = 26.0 * 10**-3                 #Volt-equivalent of temperature (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "I = Io * (math.exp(V/VT)-1)        #Current flowing (in Ampere) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Current flowing through Germanium diode is \",round(I * 10**6),\" micro-A.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.2 , Page Number 103 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Forward Voltage =  0.43 V.\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "I = 10 * 10**-3                    #Forward biased current (in Ampere)\n",
    "Io = 2.5 * 10**-6                  #Peak reverse biased current (in Ampere)\n",
    "nVT = 2*26.0 * 10**-3              #Volt-equivalent of temperature (in volts)\n",
    "n = 2                              #For Silicon\n",
    "\n",
    "#Calculation\n",
    "\n",
    "V = nVT*math.log(I/Io + 1)         #Forward Voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Forward Voltage = \",round(V,2),\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.3 , Page Number 103 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Reverse saturation current density is  0.16 micro Ampere.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ND = 10**21          #Donor concentration (in per cubic meter)\n",
    "NA = 10**22          #Acceptor concentration (in per cubic meter)\n",
    "De = 3.4 * 10**-3    #Diffusion constant for electron (in meter square per second)\n",
    "Dh = 1.2 * 10**-3    #Diffusion constant for holes (in meter square per second)\n",
    "Le = 7.1 * 10**-4    #Diffusion length for electrons (in meter)\n",
    "Lh = 3.5 * 10**-4    #Diffusion length for holes (in meter)\n",
    "ni = 1.6 * 10**16    #intrinsic concentration (in per cubic-meter)\n",
    "e = 1.6 * 10**-19    #Charge on electron (in Coulomb)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Io_by_A =  (Dh/(Lh*ND) + De/(Le*NA))*e*ni**2     #Reverse saturation current density (in Ampere per meter-square)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Reverse saturation current density is \",round(Io_by_A * 10**6,2),\"micro Ampere.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.4 , Page Number 107 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Dynamic resistance =  12.5  ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "I = 2 * 10**-3                   #Forward current (in Ampere)\n",
    "VT = 25 * 10**-3                 #Volt equivalent of temperature (in Volts)\n",
    "n = 1                            #eeta for the given semiconductor\n",
    "\n",
    "#Calculation\n",
    "\n",
    "r = n*VT/I                       #Dynamic resistance (in ohm) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Dynamic resistance = \",r,\" ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.5 , Page Number 107 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A.C. resistance =  11.86 ohm.\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "VT = 26.0 * 10**-3             #Volt equivalent of temperature (in Volts)\n",
    "V = 200 * 10**-3               #Voltage (in volts)\n",
    "Io = 1.0 * 10**-6              #Reverse saturation current (in Ampere)\n",
    "n = 1                          #For Germanium\n",
    "\n",
    "#Calculation\n",
    "\n",
    "r = n*VT/(Io*math.exp(V/(n*VT)))\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"A.C. resistance = \",round(r,2),\"ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.6 , Page Number 108 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current flowing through the circuit is  0.043 A.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vo = 0.7                  #Barrier potential (in volts)\n",
    "V = 5                     #Voltage (in volts)\n",
    "R = 100                   #Resistance (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "I = (V-Vo)/R              #Current flowing through circuit (in Ampere)   \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Current flowing through the circuit is \",I,\"A.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.7 , Page Number 109"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage drop across 7 ohm resistance is  13.6  V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vo = 0.7                  #Barrier potential (in volts)\n",
    "V = 15                    #Voltage (in volts)\n",
    "R = 7.0 * 10**3           #Resistance (in ohm) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "I = (V-2*Vo)/R              #Current (in Ampere)\n",
    "VA = I * R                #Voltage drop (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Voltage drop across 7 ohm resistance is \",VA,\" V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.8 , Page Number 109"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage drop =  14.7  V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "V = 15                    #Voltage (in volts)\n",
    "Vo = 0.3                  #Voltage across parallel connection (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VA = V - Vo               #Voltage drop (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Voltage drop = \",VA,\" V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.9 , Page Number 110"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current flowing is  62.5  mA.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Annotation at 0x4deeef0>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEZCAYAAABxbJkKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYVNW19/HvrxFEhIAosZ0xQJhEARWMQGzAgAMxEQ1C\noqKJ3jcRFScuRCG04lWRGwZFkohDAL2CN4JRogGvoaNilICg7UAUI4k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oyRidA2MtwRcykQloF8CX6ptA88SlXOicsVHZrYZeAb4fnT8dOAAwhfv04Rf+G2i\n51pLOrKKSz9E2HnsbTP7ICqLfCKpb/T8BUBJJe/bzN4vyK8QNmj5TNLBhA5uA/5C+EV8VPS689ib\nGJYAVyb8/T0qC07S2iriXkTY/m8EISHUW7Tx0J+BO4DHLaj15xG1TvYxs4XABPJ3z4Kc5y0BV1/7\nReWQxsBOYK6ZTY2eSxx5UgzcJ+llwpdt+ZrnNxJKOCOA54G/AZjZG5LGA0ujDuEdwGWErQQr+g3h\nS+/yhGMjgV9GNfqqllu+G/i9pPfNbGD0d6wlbHH6XBTHNkmXRa/7nPAFW/43TQKmS3qF8IPqr4Q9\nXveQdFDlH9ueX9uvA53NbGVVL6vifmWPyy0AHia0jsrV6vMArgbuT+iMz8vdy/KBLyXtXA0k7W9m\nn0f37wLeNLOk5j9IOhM42sxmpjNG5+rKk4BzNYiGR44EmhA6jS81s23xRuVcangScM65POYdw845\nl8c8CTjnXB7zJOCcc3nMk4BzzuUxTwLOOZfHPAk451we+/8LYPnpnvKTZAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x4a3f310>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import math\n",
    "import numpy\n",
    "%matplotlib inline\n",
    "from matplotlib.pyplot import plot,title,xlabel,ylabel,annotate\n",
    "\n",
    "#Variables\n",
    "\n",
    "VS = 10.0                   #Supply voltage (in volts)\n",
    "RL = 160                    #Resistance (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "I = VS / RL                 #Current (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Current flowing is \",I * 10**3,\" mA.\"\n",
    "\n",
    "#Graph\n",
    "\n",
    "x = numpy.linspace(0,10)\n",
    "plot(x,62.5 -62.5/10*x,'b')\n",
    "title(\"VI Characteristics\")\n",
    "xlabel(\"Diode Voltage , v in volts\")\n",
    "ylabel(\"Diode Forward Current , I in A\")\n",
    "annotate(\"Load Line\",xy=(5,35))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.11 , Page Number 120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature coefficient is  -0.0533 %.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "V25 = 5                  #Initial voltage at 25 degree celsius (in volts)\n",
    "V100 = 4.8               #Voltage at 100 degree celsius (in volts)\n",
    "t1 = 25                  #Temperature (in celsius)\n",
    "t2 = 100                 #Temperature (in celsius)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "dVZ = V100 - V25         #Change in zener voltage (in volts)\n",
    "dt = t2 - t1             #Change in temperature (in celsius)\n",
    "tc = dVZ/(V25*dt)        #Temperature coefficient\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Temperature coefficient is \",round(tc*100,4),\"%.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.12 , Page Number 123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Output Voltage =  8  V.\n",
      "Voltage across Rs =  12  V.\n",
      "Current through series resistance =  0  A.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vs = 12                         #Source voltage (in volts)\n",
    "Vout = VZ = 8                   #Output voltage (in volts)\n",
    "VRs = VS - Vout                 #Voltage across resistance in series (in volts)\n",
    "RL = 10 * 10**3                 #Load resistance (in ohm) \n",
    "Rs = 5 * 10**3                  #Resistance in series (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "IL = Vout/RL                    #Load current (in Ampere)\n",
    "Is = (Vs-Vout)/Rs               #Current through series resistance (in Ampere)\n",
    "IZ = Is - IL                    #Current through zener diode (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Output Voltage = \",Vout,\" V.\"\n",
    "print \"Voltage across Rs = \",Vs,\" V.\"\n",
    "print \"Current through series resistance = \",IZ,\" A.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.13 , Page Number 123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum value of zener diode current is  9.0  mA.\n",
      "Minimum value of zener diode current is  1.0  mA.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vout = VZ = 50              #Output voltage (in volts)\n",
    "RL = 10.0 * 10**3           #Load resistance (in ohm)\n",
    "VSmax = 120                 #Maximum voltage (in volts)\n",
    "RS = 5.0 * 10**3            #Resistance in series (in ohm)\n",
    "VSmin = 80                  #Minimum voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "IL = Vout / RL              #Load current (in Ampere)\n",
    "ISmax = (VSmax - Vout)/RS   #Maximum series current (in Ampere)\n",
    "IZmax = ISmax - IL          #Maximum zener current (in Ampere)\n",
    "ISmin = (VSmin - Vout)/RS   #Minumum series current (in Ampere)\n",
    "IZmin = ISmin - IL          #Minimum zener current (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Maximum value of zener diode current is \",IZmax * 10**3,\" mA.\\nMinimum value of zener diode current is \",IZmin * 10**3,\" mA.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.14 , Page Number 123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Series resistance is  192.3  ohm.\n",
      "When the load current will decrease and become 10 mA, the zener current will increase and become 6 + 10 i.e. 16 mA. Thus the current through the series resistance RS will remain unchanged as 6 + 20 i.e. 26 mA. Thus voltage drop in series resistance RS will remain constant. Consequently the output voltage (Vout = VS - IS*RS) will also remain constant.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IZK = 6 * 10**-3               #Minimum zener current (in Ampere)\n",
    "ILmax = 20.0 * 10**-3          #Maximum load current (in Ampere)\n",
    "VS = 20                        #Source voltage (in volts)\n",
    "Vout = 15                      #Output voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "RS = (VS - Vout)/(IZK + ILmax) #Series resistance (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Series resistance is \",round(RS,1),\" ohm.\"\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. Thus the current through the series resistance RS will remain unchanged as 6 + 20 i.e. 26 mA. Thus voltage drop in series resistance RS will remain constant. Consequently the output voltage (Vout = VS - IS*RS) will also remain constant.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.15 , Page Number 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The output voltage is  50.0  V.\n",
      "Voltage drop across RS is  70.0  V.\n",
      "Current through zener is  9.0  mA.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VL = VZ = 50.0              #Output voltage (in volts)\n",
    "VS = 120.0                  #Source voltage (in volts)\n",
    "RL = 10.0 * 10**3           #Load resistance (in ohm)\n",
    "RS = 5.0 * 10**3            #Resistance in series (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VRS = VS - VZ               #Voltage across resistance in series (in volts)\n",
    "IL = VL/RL                  #Load current (in Ampere)\n",
    "IS = VRS / RS               #Current through resistance in series (in Ampere)\n",
    "IZ = IS - IL                #Current through zener diode (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"The output voltage is \",VL,\" V.\"\n",
    "print \"Voltage drop across RS is \",VRS,\" V.\"\n",
    "print \"Current through zener is \",IZ * 10**3,\" mA.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.16 , Page Number 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VL =  8.73  V.\n",
      "IZ =  0  A.\n",
      "PZ =  0.0  W.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VS = 16.0                   #Source voltage (in volts)\n",
    "RL = 1.2 * 10**3            #Load resistance (in ohm)\n",
    "RS = 1.0 * 10**3            #Resistance in series (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VL = VS * RL/(RS + RL)      #Voltage across load (in volts)\n",
    "IZ = 0                      #Current through zener diode (in Ampere) \n",
    "PZ = VZ*IZ                  #Power across zener diode (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VL = \",round(VL,2),\" V.\"\n",
    "print \"IZ = \",IZ,\" A.\"\n",
    "print \"PZ = \",PZ,\" W.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.17 , Page Number 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VL1 =  15.0  V.\n",
      "IL1 =  47.62 \n",
      "IZ1 =  0  A.\n",
      "IR1 =  47.62  A.\n",
      "VL2 =  3.7  V.\n",
      "IL2 =  74.07  A.\n",
      "IZ2 =  0  A.\n",
      "IR2 =  74.07  A.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vin = 20                   #input voltage (in volts)\n",
    "RS = 220.0                 #Series resistance (in ohm)\n",
    "VZ = 10                    #Zener voltage (in volts)\n",
    "RL1 = 200                  #Load resistance1 (in ohm)\n",
    "RL2 = 50                   #Load resistance2 (in ohm)\n",
    "PZmax = 400 * 10**-3       #Power (in watt)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VL1 = Vin*RL1/(RS + RL1)   #Voltage across load1 (in volts)\n",
    "IL1 =IR=Vin/(RS + RL1)     #Load1 current (in Ampere)\n",
    "IZ1 = 0                    #Zener current 1 (in Ampere)\n",
    "VL2 = Vin*RL2/(RS + RL2)   #Voltage across load2 (in volts)\n",
    "IL2 =IR=Vin/(RS + RL2)     #Load2 current (in Ampere)\n",
    "IZ2 = 0                    #Zener current 2 (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VL1 = \",round(V,2),\" V.\"\n",
    "print \"IL1 = \",round(IL1*10**3,2),\"\"\n",
    "print \"IZ1 = \",IZ1,\" A.\"\n",
    "print \"IR1 = \",round(IL1*10**3,2),\" A.\"\n",
    "\n",
    "print \"VL2 = \",round(VL2,1),\" V.\"\n",
    "print \"IL2 = \",round(IL2*10**3,2),\" A.\"\n",
    "print \"IZ2 = \",IZ2,\" A.\"\n",
    "print \"IR2 = \",round(IL2*10**3,2),\" A.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.18 , Page Number 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage drop across 5 kilo-ohm resistor is  50  V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VS = 100              #Source voltage (in volts)\n",
    "VL = VZ = 50          #Voltage across load (in volts)\n",
    "V = 10.0/(10 + 5)     #Voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VR = VS - VL          #Voltage across resistance using KVL (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Voltage drop across 5 kilo-ohm resistor is \",VR,\" V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.19 , Page Number 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ri for minimum voltage is  25.0  ohm.\n",
      "Ri for maximum voltage is  25.0  ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "V = 12                 #Voltage (in volts)\n",
    "R = 120                #Resistance (in ohm)\n",
    "VDCmin = 15            #Minimum dc voltage (in volts)\n",
    "VZ = 12                #Zener voltage (in volts)\n",
    "VDCmax = 19.5          #Maximum dc voltage (in volts)\n",
    "IZmin = 20 * 10**-3    #Minimum current through zener (in Ampere) \n",
    "IL = 100 * 10**-3      #Current through load (in Ampere)\n",
    "IZmax = 200 * 10**-3   #Maximum current through zener (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VSmin = VDCmin - VZ    #Minimum voltage across Ri (in volts)\n",
    "VSmax = VDCmax - VZ    #Maximum voltage across Ri (in volts)\n",
    "ISmin = IZmin + IL     #Minimum current through Ri (in Ampere)\n",
    "Rimin = VSmin/ISmin    #Resistance Ri1 (in ohm)\n",
    "ISmax = IZmax + IL     #Minimum current through Ri (in Ampere)\n",
    "Rimax =VSmax/ISmax     #Resistance Ri2 (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Ri for minimum voltage is \",Rimin,\" ohm.\"\n",
    "print \"Ri for maximum voltage is \",Rimax,\" ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.20 , Page Number 126 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Range of RL : From  250.0 ohm to  1.25  kilo-ohm.\n",
      "Range of IL : From  8.0  mA to  40.0  mA.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vi = 50.0                #Voltage (in volts)\n",
    "R = 1.0 * 10**3          #Resistance (in ohm)\n",
    "VZ = 10.0                 #Voltage across zener (in volts)\n",
    "IZmax = 32.0 * 10**-3    #Maximum current across zener (in Ampere)\n",
    "IZmin = 0.0              #Minimum current across zener (in Ampere) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "IR = (Vi - VZ)/R         #Supply current (in Ampere)\n",
    "ILmax = IR - IZmin       #Maximum load current (in Ampere)\n",
    "RLmin = VZ/ILmax         #Minimum corresponding load resistance (in ohm)\n",
    "ILmin = IR - IZmax       #Minimum load current (in Ampere) \n",
    "RLmax = VZ/ILmin         #Maximum corresponding load resistance (in ohm)      \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Range of RL : From \",RLmin,\"ohm to \",RLmax*10**-3,\" kilo-ohm.\"\n",
    "print \"Range of IL : From \",ILmin* 10**3,\" mA to \",ILmax*10**3,\" mA.\""
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}