{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9 - Multistage Amplifier"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 424 example 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency1   =   50982.45 hertz\n",
      "frequency2   =   196145.92 hertz\n",
      "frequency   =   269258240.36 hertz\n",
      "frequency   =   76822.13 hertz\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "from __future__ import division\n",
    "#(1) frequency\n",
    "freque=100*10**3*sqrt(2**(1/3)-(1))\n",
    "frequ2=100*10**3/sqrt(2**(1/3)-(1))\n",
    "print \"frequency1   =   %0.2f\"%((freque)),\"hertz\"\n",
    "print \"frequency2   =   %0.2f\"%((frequ2)),\"hertz\"\n",
    "#(2)frequency\n",
    "freq11=100*10**6##hertz\n",
    "freq12=150*10**6##hertz\n",
    "freq13=200*10**6##hertz\n",
    "freq21=100*10**3##hertz\n",
    "freq22=150*10**3##hertz\n",
    "freq23=200*10**3##hertz\n",
    "frequ1=sqrt(freq11**2+freq12**2+freq13**2)\n",
    "print \"frequency   =   %0.2f\"%((frequ1)),\"hertz\"##correction in the book 269.25mega hertz\n",
    "frequ1=1/sqrt((1/(freq21**2))+(1/(freq22**2))+(1/(freq23**2)))\n",
    "print \"frequency   =   %0.2f\"%((frequ1)),\"hertz\"##correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 424 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "coupling capacitance   =   5.48e-06 /r`\n"
     ]
    }
   ],
   "source": [
    "freque=60##hertz\n",
    "frequ1=freque*0.484\n",
    "cb=1/(frequ1*2*3.14*10**3)\n",
    "print \"coupling capacitance   =   %0.2e\"%((cb)),\"/r`\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 425 example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cb   =   6.28e-08 farad\n",
      "cb   =   8.92e-08 farad\n",
      "gain of each stage   =   1.06e-03\n"
     ]
    }
   ],
   "source": [
    "g=10*10**-3##ampere per volt\n",
    "rd=5.5*10**3##ohm\n",
    "rg=1*10**6##ohm\n",
    "#(1) cb frequency 1decibel to 10hertz\n",
    "ri=rg\n",
    "r1=(rd*8*10**3)/(rd+8*10**3)\n",
    "cb=10**-6/(3.14*5.07)\n",
    "print \"cb   =   %0.2e\"%((cb)),\"farad\"\n",
    "#(2) cb\n",
    "cb=(cb*(5)/(3.52))\n",
    "print \"cb   =   %0.2e\"%((cb)),\"farad\"\n",
    "#(3) gain\n",
    "a1=g**2*(3.26**2)\n",
    "print \"gain of each stage   =   %0.2e\"%((a1))\n",
    "#correction required in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 427 example 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "upper frequency   =   78895.46 hertz\n",
      "lower frequency   =   20408.16 hertz\n"
     ]
    }
   ],
   "source": [
    "freque=40*10**3##hertz\n",
    "frequ1=freque/0.507\n",
    "print \"upper frequency   =   %0.2f\"%((frequ1)),\"hertz\"\n",
    "frequ1=freque/1.96\n",
    "print \"lower frequency   =   %0.2f\"%((frequ1)),\"hertz\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 427 example 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "overal voltage gain   =   62.01 decibel\n",
      "lower frequency of each   =   31.70 hertz\n",
      "lower frequency overal   =   62.13 hertz\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "g=2.6*10**-3##ampere per volt\n",
    "rd=7.7*10**3##ohm\n",
    "rd1=12*10**3##ohm\n",
    "cb=0.005*10**-6##farad\n",
    "#(1) voltage gain\n",
    "volgai=g*((1/rd)+1/rd1+1/(1*10**3))\n",
    "volgai=(20*(log10(10.8)))*3\n",
    "print \"overal voltage gain   =   %0.2f\"%((volgai)),\"decibel\"##correction in the book\n",
    "#(2) lower frequency\n",
    "r=rd*rd1/(rd+rd1)\n",
    "freque=1/((2*3.14)*(r+1*10**6)*cb)\n",
    "print \"lower frequency of each   =   %0.2f\"%((freque)),\"hertz\"\n",
    "#(3) overal lower frequency\n",
    "freque=freque*1.96\n",
    "print \"lower frequency overal   =   %0.2f\"%((freque)),\"hertz\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 429 example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage gain   =   2851.60\n",
      "cb   =   2.61e-06 farad\n",
      "cb   <=   1.64e-05 farad\n"
     ]
    }
   ],
   "source": [
    "hfe=50\n",
    "hie=1.1*10**3##ohm\n",
    "#(1) gain\n",
    "r1=2*10**3##ohm\n",
    "volgai=-hfe*r1/(hie)\n",
    "r11=25*10**3*hie/(25*10**3+hie)\n",
    "r11=r1*r11/(r1+r11)\n",
    "volga1=-hfe*r11/hie\n",
    "volgai=volgai*volga1\n",
    "print \"voltage gain   =   %0.2f\"%((volgai))\n",
    "freque=20##hertz\n",
    "ri=25*10**3*hie/(25*10**3+hie)\n",
    "cb=1/(2*3.14*(ri+r1)*(freque))\n",
    "print \"cb   =   %0.2e\"%((cb)),\"farad\"\n",
    "cb=1/(2*3.14*3.05*10**3*10/3.14)\n",
    "print \"cb   <=   %0.2e\"%((cb)),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 432 example 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta1   =   5.71\n",
      "phase constant 10f1<=f<=0.1f11\n"
     ]
    }
   ],
   "source": [
    "from math import atan, degrees\n",
    "theta1=degrees(atan(0.1))\n",
    "print \"theta1   =   %0.2f\"%((theta1))\n",
    "print \"phase constant 10f1<=f<=0.1f11\""
   ]
  }
 ],
 "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
}