{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter - 32 : OPERATIONAL AMPLIFIERS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.1 Pg 919"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CMRR=89.99 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log10\n",
    "Adm=200000#\n",
    "Acm=6.33#\n",
    "CMRR=20*log10(Adm/Acm)#\n",
    "print 'CMRR=%0.2f dB'%CMRR"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.2 Pg 919"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Acm=0.95 \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Adm=30000#\n",
    "#CMRR=20*log10(Adm/Acm)#\n",
    "a=90/20#\n",
    "Acm=(Adm/10**a)#\n",
    "print \"Acm=%0.2f \"%(Acm)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.3 Pg 919"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fmax=795.77 kHZ\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi\n",
    "#e.g 32.3\n",
    "SR=0.5*10**6#\n",
    "Vpk=0.1#\n",
    "fmax=SR/(2*pi*Vpk)#\n",
    "print 'fmax=%0.2f kHZ'%(fmax*10**-3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.4 Pg 920"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fmax=7957.75 HZ\n",
      "fmax=206.90 kHZ\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi\n",
    "Vpk=10#\n",
    "slewrate=0.5*10**6#\n",
    "fmax=slewrate/(2*pi*Vpk)#\n",
    "print 'fmax=%0.2f HZ'%fmax #value of microamp 741\n",
    "slewrate=13*10**6#\n",
    "fmax=slewrate/(2*pi*Vpk)#\n",
    "print 'fmax=%0.2f kHZ'%(fmax*10**-3) #TLO 81\n",
    "#value of microamp 741 is much lower than that of the input signal.And value of TLO81 is much higher than input signal,therefore TLO81 can be used"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.5 Pg 920"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vin=40.00 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "ACL=200#\n",
    "Vout=8#\n",
    "Vin=Vout/ACL#\n",
    "print 'Vin=%0.2f mV'%(Vin*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.8 Pg 920"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "V0=2.00 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "R1=1*10**3#\n",
    "R2=2*10**3#\n",
    "Vi=1#\n",
    "Acl=R2/R1#\n",
    "V0=Acl*Vi#\n",
    "print 'V0=%0.2f V'%V0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.9 Pg 921"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Acl=10.00\n",
      "Zin=10.00 kohm\n",
      "Zout=80.00 ohm\n",
      "CMRR=10000.00 \n",
      "fmax=15.92 kHZ\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi\n",
    "Acm=0.001#\n",
    "Aol=180000#\n",
    "Zin=1*10**6#\n",
    "Zout=80#\n",
    "SR=0.5#\n",
    "R2=100*10**3#\n",
    "R1=10*10**3#\n",
    "Acl=R2/R1#\n",
    "print \"Acl=%0.2f\"%Acl\n",
    "Zin=R1#\n",
    "print 'Zin=%0.2f kohm'%(Zin*10**-3)\n",
    "print 'Zout=%0.2f ohm'%Zout\n",
    "CMRR=Acl/Acm#\n",
    "print \"CMRR=%0.2f \"%CMRR\n",
    "Vpk=5#\n",
    "fmax=SR/(2*pi*Vpk)#\n",
    "print 'fmax=%0.2f kHZ'%(fmax*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.10 Pg 921"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Acl=11.00\n",
      "CMRR=11000.00\n",
      "fmax=14.47 kHZ\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi\n",
    "R2=100*10**3#\n",
    "R1=10*10**3#\n",
    "Acl=1+(R2/R1)#\n",
    "Acm=0.001#\n",
    "print \"Acl=%0.2f\"%Acl\n",
    "CMRR=Acl/Acm#\n",
    "print \"CMRR=%0.2f\"%CMRR\n",
    "SR=0.5#\n",
    "Vpk=5.5#\n",
    "fmax=SR/(2*pi*Vpk)#\n",
    "print 'fmax=%0.2f kHZ'%(fmax*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.11 Pg 922"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CMRR=1000.00\n",
      "fmax=26.53 kHZ\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Acm=0.001#\n",
    "AOL=180000#\n",
    "Zin=1*10**6#\n",
    "Zout=80#\n",
    "SR=0.5#\n",
    "Acl=1#\n",
    "CMRR=Acl/Acm#\n",
    "print \"CMRR=%0.2f\"% CMRR\n",
    "Vpk=3#\n",
    "fmax=SR/(2*pi*Vpk)\n",
    "print 'fmax=%0.2f kHZ'%(fmax*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.12 Pg 922"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vout=-3.52 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "V1= 0.1#\n",
    "V2=1#\n",
    "V3=0.5#\n",
    "R1=10*10**3#\n",
    "R2=10*10**3#\n",
    "R3=10*10**3#\n",
    "R4=22*10**3#\n",
    "Vout=((-R4*V1)/R1)+((-R4*V2)/R2)+((-R4*V3)/R3)#\n",
    "print 'Vout=%0.2f V'%Vout"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 32.14 Pg 922"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vout=4.00 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "V1=-2#\n",
    "V2=2#\n",
    "V3=-1#\n",
    "R1=200*10**3#\n",
    "R2=250*10**3#\n",
    "R3=500*10**3#\n",
    "Rf=1*10**6#\n",
    "Vout=(-Rf/R1)*V1+(-Rf/R2)*V2+(-Rf/R3)*V3#\n",
    "print 'Vout=%0.2f V'%Vout"
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
