{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 11 - Sinusoidal Oscillators"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 514 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min frequency   =   1769.29hertz\n",
      "max frequency   =   17692.85hertz\n",
      "resistance r3   =   20000.00ohm\n"
     ]
    }
   ],
   "source": [
    "macapa=900*10**-12##farad\n",
    "micapa=90*10**-12##farad\n",
    "r=100*10**3##ohm\n",
    "#(a) frequency range\n",
    "fremin=1/(2*3.14*r*macapa)\n",
    "print \"min frequency   =   %0.2f\"%((fremin))+\"hertz\"\n",
    "fremax=1/(2*3.14*r*micapa)\n",
    "print \"max frequency   =   %0.2f\"%((fremax))+\"hertz\"\n",
    "#(b) r3\n",
    "r=10*10**3##ohm\n",
    "r3=2*r\n",
    "print \"resistance r3   =   %0.2f\"%((r3))+\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 516 example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min voltage   >=   7.50volt\n",
      "frequency   =   42379.83hertz\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "c1=0.004*10**-6##farad\n",
    "c2=0.03*10**-6##farad\n",
    "induct=4*10**-3##henry\n",
    "#min voltage\n",
    "mivolt=c2/c1\n",
    "print \"min voltage   >=   %0.2f\"%((mivolt))+\"volt\"\n",
    "#frequency\n",
    "freque=(((1/(2*3.14)))*sqrt((c1+c2)/(induct*c1*c2)))\n",
    "print \"frequency   =   %0.2f\"%((freque))+\"hertz\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 517 example 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency   =   166467.63hertz\n",
      "ratio1 greater than 1 so oscillations possible\n"
     ]
    }
   ],
   "source": [
    "induct=500*10**-6##henry\n",
    "induc1=5000*10**-6##henry\n",
    "mutuin=300*10**-6##henry\n",
    "c1=150*10**-12##farad\n",
    "#(a) frequency\n",
    "indcto=induct+induc1+2*mutuin\n",
    "freque=1/((2)*3.14*sqrt(indcto*c1))\n",
    "#(b) condition\n",
    "r=10*10**3##ohm\n",
    "conduc=8*10**-3##ampere per volt\n",
    "r1=50*10**3##ohm\n",
    "r_=r*r1/(r+r1)\n",
    "volgai=conduc*r_\n",
    "print \"frequency   =   %0.2f\"%((freque))+\"hertz\"\n",
    "ratio1=(induc1+mutuin)/(induct+mutuin)\n",
    "ratio1=ratio1*volgai\n",
    "print \"ratio1 greater than 1 so oscillations possible\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 518 example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resonanting capacitance   =   5.00e-14farad\n",
      "resonant frequency   =   1.42e+06hertz\n",
      "parallel resonant frequency   =   1.03e+06hertz\n",
      "series resonant frequency   =   1.01e+06hertz\n",
      "quality factor   =   3162.28\n",
      "loop gain   =   100.00\n",
      "bias   =   6.00e-05second\n"
     ]
    }
   ],
   "source": [
    "cgs=5*10**-12##farad\n",
    "cds=1*10**-12##farad\n",
    "conduct=10*10**-3##ampere per volt\n",
    "rd=50*10**3##ohm\n",
    "r=10*10**6##ohm\n",
    "induct=0.5##henry\n",
    "c1=0.05*10**-12##farad\n",
    "rse=1*10**3##ohm\n",
    "c=1*10**-12##farad\n",
    "#(1) c11\n",
    "c11=((((cds*cgs)/(cds+cgs))+1)*c1)/(((cds*cgs)/(cds+cgs))+1+c1)\n",
    "print \"resonanting capacitance   =   %0.2e\"%((c11))+\"farad\"\n",
    "#(2) frequency\n",
    "freque=((sqrt(2))/(2*3.14*sqrt(induct*c11)))\n",
    "print \"resonant frequency   =   %0.2e\"%((freque))+\"hertz\"\n",
    "#(3) frequency parallel\n",
    "\n",
    "freque=1/(2*3.14*sqrt(((induct*c*c1))/(c+c1)))\n",
    "print \"parallel resonant frequency   =   %0.2e\"%((freque))+\"hertz\"\n",
    "#frequency series\n",
    "freque=1/((2*3.14*sqrt(induct*c1)))\n",
    "print \"series resonant frequency   =   %0.2e\"%((freque))+\"hertz\"\n",
    "qualit=((induct/c1)**(0.5))/rse\n",
    "print \"quality factor   =   %0.2f\"%((qualit))\n",
    "#correction required in book\n",
    "#(4) loop gain\n",
    "abeta1=conduct*rd*cds/cgs\n",
    "print \"loop gain   =   %0.2f\"%((abeta1))\n",
    "#(5)\n",
    "w=r*(cds+cgs)\n",
    "print \"bias   =   %0.2e\"%((w))+\"second\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 519 example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency   =   1.23e+06hertz\n",
      "gain   =   5.00\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "c=200*10**-12##farad\n",
    "c1=1000*10**-12##farad\n",
    "induct=100*10**-6##henry\n",
    "#(1) frequency\n",
    "ceq=(c*c1)/(c+c1)\n",
    "freque=1/(2*3.14*(sqrt(induct*ceq)))\n",
    "print \"frequency   =   %0.2e\"%((freque))+\"hertz\"##correction in the book\n",
    "gaimin=c1/c\n",
    "print \"gain   =   %0.2f\"%((gaimin))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 520 example 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance   =   4.02e-05henry\n"
     ]
    }
   ],
   "source": [
    "induc1=0.4*10**-3##henry\n",
    "c=0.004*10**-6##farad\n",
    "freque=120*10**3##hertz\n",
    "induct=((1/(4*3.14**2*freque**2*c)))-induc1\n",
    "print \"inductance   =   %0.2e\"%((induct))+\"henry\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 520 example 9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency   =   1087243.22hertz\n",
      "ratio parallel series   =   1.03\n",
      "quality factor   =   409.67\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "induct=0.33##henry\n",
    "c=0.065*10**-12##farad\n",
    "c1=1*10**-12##farad\n",
    "r=5.5*10**3##ohm\n",
    "#(1) series resonant frequency\n",
    "freque=(1/(2*(3.14)))*sqrt(1/((induct)*c))\n",
    "print \"frequency   =   %0.2f\"%((freque))+\"hertz\"\n",
    "#(2)exceed of frequency\n",
    "ratio1=sqrt((1+(c/c1)))\n",
    "print \"ratio parallel series   =   %0.2f\"%((ratio1))\n",
    "#correction required in the book\n",
    "#(3) quality factor\n",
    "qualit=(1/r)*sqrt(induct/c)\n",
    "print \"quality factor   =   %0.2f\"%((qualit))"
   ]
  }
 ],
 "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
}