{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 - Special Semiconductor Diodes "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 138 example 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance range from 196.00  to 217.78 ohms\n",
      "resistance range at 50 from 146.00  to 167.78 ohms\n"
     ]
    }
   ],
   "source": [
    "#zener diode\n",
    "voltag=5.2##volts\n",
    "w=260*10**-3##watts\n",
    "appv=15##voltsw1=50##watts\n",
    "imax=w/voltag*0.1#\n",
    "#to maitain a constant voltage\n",
    "imax1=(w/voltag)-imax#\n",
    "resmin=(appv-voltag)/(w/voltag)#\n",
    "resmax=(appv-voltag)/imax1#\n",
    "#load 50\n",
    "resmax1=((9.8)/(45*10**-3))-50#\n",
    "resmin1=((9.8)/(50*10**-3))-50#\n",
    "res50=resmax1-resmin1#\n",
    "print \"resistance range from %0.2f\"%(resmin),\" to %0.2f\"%(resmax),\"ohms\"\n",
    "print \"resistance range at 50 from %0.2f\"%(resmin1),\" to %0.2f\"%(resmax1),\"ohms\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 139 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage drop   =   5.67volts\n"
     ]
    }
   ],
   "source": [
    "i1=20*10**-3##ampere\n",
    "i=30*10**-3##ampere\n",
    "v1=5.6##volts\n",
    "v=5.65##volts\n",
    "#condition\n",
    "u=35*10**-3##ampere\n",
    "voltag=5*u+5.5#\n",
    "print \"voltage drop   =   %0.2f\"%(voltag)+\"volts\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 139 example 3 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fi0   =   4.96\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "v=4.3##volt\n",
    "q=4##volt\n",
    "dop=10**17##per cubic centimetre\n",
    "fi0=0.254*log(dop/(5.1*10**10))#\n",
    "fi01=0.407+q+0.55#\n",
    "print 'fi0   =   %0.2f'%(fi01)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 140example 4 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current   =   9.95e-05 ampere\n",
      "resistance   =   1.61e+05 ohm\n",
      "r1   =   1.60e+05 ohm\n",
      "r2   =   4.02e+04 ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "v1=20##volt\n",
    "i1=((v1)/(200+1))*10**-3#\n",
    "print 'current   =   %0.2e'%(i1),'ampere'\n",
    "#greater than 20\n",
    "vone=16#\n",
    "r=vone/i1#\n",
    "r1=r-1*10**3#\n",
    "r11=200*10**3-r1#\n",
    "print 'resistance   =   %0.2e'%(r),'ohm'\n",
    "print \"r1   =   %0.2e\"%((r1)),\"ohm\"\n",
    "print \"r2   =   %0.2e\"%((r11)),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 142 example 6 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum current   =   0.035 ampere\n",
      "v1 minimum   =   262.50 volt\n",
      "v1 maximum   =   393.75 volt\n"
     ]
    }
   ],
   "source": [
    "v1=150##volt\n",
    "vone=300#volt\n",
    "idmax=40*10**-3##ampere\n",
    "idmin=5*10**-3##ampere\n",
    "r=(vone-v1)/idmax#\n",
    "imax=idmax-idmin#\n",
    "print 'maximum current   =   %0.3f'%(imax),'ampere'\n",
    "#minimum\n",
    "zq=1#\n",
    "while (zq<=2):\n",
    "    if zq==1 :\n",
    "        ione=25*10**-3#\n",
    "        i1=ione+idmin#\n",
    "        vmin=(i1*r)+v1#\n",
    "        print 'v1 minimum   =   %0.2f'%(vmin),'volt'\n",
    "    else:\n",
    "        ione=25*10**-3#\n",
    "        i1=ione+idmax#\n",
    "        vmin=(i1*r)+v1#\n",
    "        print 'v1 maximum   =   %0.2f'%(vmin),'volt'\n",
    "        \n",
    "    \n",
    "    zq=zq+1#\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 142 example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width   =   2.22e-08 metre\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "q=4.5*10**22##atoms per cubic metre\n",
    "na=q/(10**4)#\n",
    "eo=0.026*24.16#\n",
    "e=1.6*10**-19#\n",
    "W=sqrt((4*16*0.628)/(36*3.14*10**9*na*10**6*e))#\n",
    "print 'width   =   %0.2e'%(W),'metre'"
   ]
  }
 ],
 "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
}