{
 "metadata": {
  "name": "",
  "signature": "sha256:2130051c161e1eb65736d42ad2b9fa42d44b0f62f874e5840e1f283681b2b0e1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : \n",
      " Amplifiers and Operational Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8  Page No : 84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 6.8\")\n",
      "# Given\n",
      "#R1 =  10kohm R2 = 50kohm Ri = 500kohm R0 = 0\")\n",
      "#Open loop gain (A) = 10**5\")\n",
      "A = 10**5;\n",
      "R1 = 10*10**3;\n",
      "R2 = 50*10**3;\n",
      "Ri = 500.*10**3;\n",
      "#From figure 6.11\n",
      "#Applying KCL equation at node B\n",
      "#(v1+vd)/10+ (v2+vd)/50+ vd/500 = 0          (1)\")\n",
      "#Since R0 = 0\n",
      "#v2 = A*vd\")\n",
      "#Solving for vd\n",
      "#vd = 10**-5*v2      (2)\")\n",
      "#Substituting (2) in (1) we get\n",
      "print \"v2/v1 = %d\"%(-5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "v2/v1 = -5\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10  Page No : 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Given\n",
      "#R1 = 1 ohm;R2 = 1/2 ohm;R3 = 1/4 ohm;R4 = 1/8 ohm\")\n",
      "#Rf = 1 ohm\")\n",
      "#From figure 6.14\n",
      "#THe output of summing circuit can be written as\n",
      "#v0 = -((Rf/R1)*v1+(Rf/R2)*v2+(Rf/R3)*v3+......\")\n",
      "#From above equation\n",
      "#v0 = -(8v4+4v3+2v2+v1)-----------(1)\")\n",
      "#a)\")\n",
      "v1 = 1;\n",
      "v2 = 0;\n",
      "v3 = 0;\n",
      "v4 = 1;\n",
      "\n",
      "# Calculation and Results\n",
      "#Substituting in equation (1)\n",
      "v0 = -(8*v4+4*v3+2*v2+v1)\n",
      "print \"v0 = %dV\"%(v0);\n",
      "\n",
      "#b)\")\n",
      "v1 = 0;v2 = 1;v3 = 1;v4 = 1;\n",
      "#Substituting in equation (1)\n",
      "v0 = -(8*v4+4*v3+2*v2+v1)\n",
      "print \"v0 = %dV\"%(v0);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "v0 = -9V\n",
        "v0 = -14V\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}