{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 - Semiconductor Diodes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 99 example 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of reverse saturation current   =   4963.36\n"
     ]
    }
   ],
   "source": [
    "q=0.01##centimetre\n",
    "sigma1=1##ohm centimetre inverse\n",
    "q1=0.01##centimetre\n",
    "sigm11=0.01##ohm centimetre inverse\n",
    "iratio=(0.0224**2*2.11*20)*3.6**2/((3.11*(4.3**2*10**-6)**2*2.6*20*10**3))#\n",
    "for q in range(0,2):\n",
    "    if q==1:\n",
    "        un=3800#\n",
    "        up=1500#\n",
    "        q=1.6*10**-19#\n",
    "        ni=2.5*10#\n",
    "    else:\n",
    "        q=1.6*10**-19#\n",
    "        up=500\n",
    "        un=1300#\n",
    "        ni=1.5*10\n",
    "\n",
    "    \n",
    "    b=un/up#\n",
    "    sigmai=(un+up)*q*ni#\n",
    "\n",
    "print \"ratio of reverse saturation current   =   %0.2f\"%((iratio))\n",
    "##correction required in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 100 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reverse current ratio   =   7.79e-09\n"
     ]
    }
   ],
   "source": [
    "sigma1=0.01##ohm centimetre inverse\n",
    "area11=4*10**-3##metre square\n",
    "q=0.01*10**-2##metre\n",
    "un=1300.0#\n",
    "up=500.0#\n",
    "ni=1.5*10**15##per cubic centimetre\n",
    "sigma1=(un+up)*1.6*10**-19*ni#\n",
    "iratio=(4*10**-10*0.026*sigma1**2*2.6*2/10**-4)/3.6**2#\n",
    "print \"reverse current ratio   =   %0.2e\"%((iratio))\n",
    "##correction required in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 100 example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reverse saturation current   =   3.48e-06 ampere\n"
     ]
    }
   ],
   "source": [
    "a=4*10**-4##metre square\n",
    "sigmap=1#\n",
    "sigman=0.1#\n",
    "de=0.15#\n",
    "vtem=26*10**-3#\n",
    "i=(a*vtem*((2.11)*(0.224))/((3.22)**(2)))*((1/de*sigman)+(1/de*sigmap))#\n",
    "print \"reverse saturation current   =   %0.2e\"%(i),\"ampere\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 101 example 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage at which the reverse saturation current at saturate   =   -0.06 volt\n",
      "reverse saturation current   =   -6.84 ampere\n",
      "reverse saturation current 0.10    =   0.000 ampere\n",
      "reverse saturation current 0.20    =   0.022 ampere\n",
      "reverse saturation current 0.30    =   1.026 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import log, exp\n",
    "w=0.9#\n",
    "voltaf=0.05##volt\n",
    "revcur=10*10**-6##ampere\n",
    "#(1) voltage\n",
    "volrev=0.026*(log((-w+1)))##voltage at which the reverse saturation current at saturate\n",
    "resacu=((exp(voltaf/0.026)-1)/((exp(-voltaf/0.026)-1)))##reverse saturation current\n",
    "print \"voltage at which the reverse saturation current at saturate   =   %0.2f\"%((volrev)),\"volt\"\n",
    "print \"reverse saturation current   =   %0.2f\"%((resacu)),\"ampere\"\n",
    "u=0.1#\n",
    "for q in range(0,3):\n",
    "        reverc=revcur*(exp((u/0.026))-1)\n",
    "        print \"reverse saturation current %0.2f\"%((u)),\"   =   %0.3f\"%((reverc)),\"ampere\"\n",
    "        u=u+0.1#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 103 example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "capacitance   =   7.08e-11 farad\n"
     ]
    }
   ],
   "source": [
    "a=1*10**-6##metre square\n",
    "w=2*10**-6##thick centimetre\n",
    "re=16#\n",
    "eo=8.854*10**-12#\n",
    "c=(eo*re*a)/w#\n",
    "print \"capacitance   =   %0.2e\"%(c),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 105 example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width of depletion layer at -10.00    =   7.73e-06 metre\n",
      "width of depletion layer at -0.10    =   1.33e-06 metre\n",
      "width of depletion layer at 0.10    =   7.65e-07 metre\n",
      "capacitance at -10.00    =   1.57e-11 farad\n",
      "capacitance at -0.10    =   9.13e-11 farad\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "volbar=0.2##barrier voltage for germanium volt\n",
    "na=3*10**20##atoms per metre\n",
    "#(1) width of depletion layer at 10 and 0.1 volt\n",
    "\n",
    "for q in [-10, -0.1, 0.1]:\n",
    "    w=2.42*10**-6*sqrt((0.2-(q)))#\n",
    "    print \"width of depletion layer at %0.2f\"%((q)),\"   =   %0.2e\"%((w)),\"metre\"#for -0.1volt correction in the book\n",
    "\n",
    "#(d) capacitance\n",
    "for q in [-10, -0.1]:\n",
    "    capaci=0.05*10**-9/sqrt(0.2-q)#\n",
    "    print \"capacitance at %0.2f\"%((q)),\"   =   %0.2e\"%((capaci)),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 104 example 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum forward current   =   2.22 ampere\n",
      "forward diode resistance   =   0.40 ohm\n"
     ]
    }
   ],
   "source": [
    "p=2##watts\n",
    "voltaf=900*10**-3##volt\n",
    "i1=p/voltaf#\n",
    "r1=voltaf/i1#\n",
    "print \"maximum forward current   =   %0.2f\"%(i1),\"ampere\"\n",
    "\n",
    "\n",
    "print \"forward diode resistance   =   %0.2f\"%(r1),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 108 example 11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha   =   104.86 degree\n"
     ]
    }
   ],
   "source": [
    "from math import atan, degrees\n",
    "r=250##ohm\n",
    "c=40*10**-6##farad\n",
    "alpha1=180-degrees(atan(377*r*c))\n",
    "print \"alpha   =   %0.2f\"%(alpha1),\"degree\"       "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 109 example 12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance   =   3022899.27 henry\n",
      "output voltage   =   31.03 volt\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "i1=0.1##current in ampere\n",
    "vms=40##rms voltage in volts\n",
    "c=40*10**-6##capacitance in farad\n",
    "r1=50##resistance in ohms\n",
    "ripple=0.0001#\n",
    "induct=((1.76/c)*sqrt(0.472/ripple))##inductance\n",
    "outv=(2*sqrt(2)*vms)/3.14-i1*r1##output voltage\n",
    "print \"inductance   =   %0.2f\"%(induct),\"henry\"#correction in the book\n",
    "print \"output voltage   =   %0.2f\"%(outv),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 109 example 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ripple voltage   =   0.093 volt\n",
      "ripple voltage including filters   =   118.49 volt\n",
      "ripple voltage   =   0.0040 volt\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "voltag=40##volt\n",
    "i1=0.2##ampere\n",
    "c1=40*10**-6##farad\n",
    "c2=c1#\n",
    "induct=2##henry\n",
    "#(1) ripple\n",
    "vdc=2*sqrt(2)*voltag/3.14#\n",
    "r1=vdc/i1#\n",
    "induc1=r1/1130#\n",
    "v1=voltag/(3*3.14**3*120**2*4*induct*c1)#\n",
    "print \"ripple voltage   =   %0.3f\"%((v1)),\"volt\"\n",
    "#(2) with two filter\n",
    "v1=4*voltag/((3*3.14**5)*(16*120**2*induct**2*c1**2))#\n",
    "print \"ripple voltage including filters   =   %0.2f\"%((v1)),\"volt\"#correction in the book\n",
    "#(3)ripple voltage\n",
    "v1=4*voltag/(5*3.14*1.414*2*3.14*240*240*3.14*induct*c1)#\n",
    "v1=v1/20#\n",
    "print \"ripple voltage   =   %0.4f\"%((v1)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 111 example 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage and ripple with load\n",
      "vdc   =   250.21 volt\n",
      "ripple   =   3.13e-02\n",
      "capacitance connected across load\n",
      "vdc   =   497.91 volt\n",
      "ripple   =   3.76e-02\n",
      "filter containing two inductors and capacitors in parallel\n",
      "vdc   =   250.00 volt\n",
      "ripple   =   6.48e-04\n",
      "two filter\n",
      "vdc   =   250.00 volt\n",
      "ripple   =   4.76e-06\n",
      "vdc   =   358.26 volt\n",
      "ripple   =   1.61e-04\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "voltag=375##volt\n",
    "r1=2000##ohm\n",
    "induct=20##henry\n",
    "c1=16*10**-6##farad\n",
    "r11=100##ohm\n",
    "r=200##ohm\n",
    "#(1) voltage and ripple with load\n",
    "print \"voltage and ripple with load\"\n",
    "r=r+r11+400#\n",
    "vdc=((2*sqrt(2)*voltag/3.14))/1.35#\n",
    "ripple=r1/(3*sqrt(2)*(377)*induct*2)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(2) capacitance connected across load\n",
    "print \"capacitance connected across load\"\n",
    "vdc=sqrt(2)*voltag/(1+1/(4*(60)*r1*2*c1))#\n",
    "ripple=1/(4*sqrt(3)*(60)*r1*2*c1)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(3) filter containing two inductors and capacitors in parallel\n",
    "print \"filter containing two inductors and capacitors in parallel\"\n",
    "vdc=250##volt\n",
    "ripple=0.83*10**-6/(2*induct*2*c1)##correction in the book\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(4) two filter\n",
    "print \"two filter\"\n",
    "vdc=250#\n",
    "ripple=sqrt(2)/(3*16*3.14**2*60**2*induct*c1)**2##correction in the book\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "vdc=sqrt(2)*voltag/(1+(4170/(r1*16))+(r/r1))#\n",
    "ripple=3300/(16**2*2*20*r1)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 112 example 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage   =   362.14 volt\n",
      "ripple voltage   =   1.46e-03\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "capaci=4##farad\n",
    "induct=20##henry\n",
    "i1=50*10**-3##ampere\n",
    "resist=200##ohm\n",
    "maxvol=300*sqrt(2)#\n",
    "vdc=maxvol-((4170/capaci)*(i1))-(i1*resist)#\n",
    "ripple=(3300*i1)/((capaci**2)*(induct)*353)#\n",
    "print \"output voltage   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple voltage   =   %0.2e\"%((ripple))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 113 example 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance of filter   =   4.98 henry\n",
      "resistance of filter   =   250.00 ohm\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "voltag=25##volt\n",
    "c1=10*10**-6##farad\n",
    "i1=100*10**-3##ampere\n",
    "ripple=0.001#\n",
    "w=754##radians\n",
    "#(1) inductance and resistance\n",
    "\n",
    "\n",
    "r1=voltag/i1#\n",
    "induct=40/(sqrt(2)*w**2*(c1))#\n",
    "print \"inductance of filter   =   %0.2f\"%((induct)),\"henry\"#correction in the book\n",
    "print \"resistance of filter   =   %0.2f\"%((r1)),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 113 example 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current   =   2.83e-04 ampere\n",
      "current at 100celsius rise\n",
      "current   =   6.81e-04 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "resacu=0.1*10**-12##ampere\n",
    "u=20+273##kelvin\n",
    "voltaf=0.55##volt\n",
    "w=1.38*10**-23#\n",
    "q=1.6*10**-19#\n",
    "for z in range(1,3):\n",
    "    if z==2 :\n",
    "        u=100+273#\n",
    "        print \"current at 100celsius rise\"\n",
    "    \n",
    "    voltag=w*u/q#\n",
    "    i1=(10**-13)*(exp((voltaf/voltag))-1)#\n",
    "    if z==2:\n",
    "        i1=(256*10**-13)*((exp(voltaf/voltag)-1))#\n",
    "    \n",
    "    print \"current   =   %0.2e\"%((i1)),\"ampere\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 114 example 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thermal voltage   =   0.026 volt\n",
      "barrier voltage   =   0.535 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "na=10*22##atoms per cubic metre\n",
    "nd=1.2*10**21##donor per cubic metre\n",
    "voltag=1.38*10**-23*(273+298)/(1.6*10**-19)##correction in the book\n",
    "voltag=0.026#\n",
    "ni=1.5*10**16#\n",
    "ni=ni**2#\n",
    "v1=voltag*log((na*nd)/(ni))#\n",
    "print \"thermal voltage   =   %0.3f\"%((voltag)),\"volt\"\n",
    "print \"barrier voltage   =   %0.3f\"%(abs(v1)),\"volt\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 114 example 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current   =   9.16e-06 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "i1=2*10**-7##ampere\n",
    "voltag=0.026##volt\n",
    "i=i1*((exp(0.1/voltag)-1))#\n",
    "print \"current   =   %0.2e\"%((i)),\"ampere\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 115 example 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance at 150mvolt   =   80.74 ohm\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "resacu=1*10**-6##ampere\n",
    "voltaf=150*10**-3##volt\n",
    "w=8.62*10**-5#\n",
    "voltag=0.026##volt\n",
    "u=300##kelvin\n",
    "uw=u*w#\n",
    "resist=(uw)/((resacu)*exp(voltaf/voltag))#\n",
    "print \"resistance at 150mvolt   =   %0.2f\"%((resist)),\"ohm\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 115 example 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in barrier   =   0.18 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "dopfac=1000#\n",
    "w=300##kelvin\n",
    "q=0.026*log(dopfac)#\n",
    "print \"change in barrier   =   %0.2f\"%((q)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 116 example 23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "depletion capacitance   =   1.09e-11 farad\n",
      "capacitance   =   3.85e-07 farad\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "area12=1*10**-8##metre square\n",
    "volre1=-1##reverse voltage\n",
    "capac1=5*10**-12##farad\n",
    "volbu1=0.9##volt\n",
    "voltag=0.5##volt\n",
    "i1=10*10**-3##ampere\n",
    "durmin=1*10**-6##ssecond\n",
    "#(1) capacitance\n",
    "capac1=capac1*sqrt((volre1-volbu1)/(voltag-volbu1))#\n",
    "print \"depletion capacitance   =   %0.2e\"%((capac1)),\"farad\"\n",
    "#(2) capacitance\n",
    "capac1=i1*durmin/(0.026)#\n",
    "\n",
    "print \"capacitance   =   %0.2e\"%((capac1)),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 116 example 24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential germanium   =   0.34 volt\n",
      "potential silicon   =   0.74 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "quantg=4*10**22##atoms per cubic centimetre\n",
    "quants=5*10**22##atoms per cubic centimetre\n",
    "w=2.5*10**13##per cubic centimetre\n",
    "w1=1.5*10**10##per cubic centimetre\n",
    "for q in [quantg, quants]:\n",
    "    na=2*q/(10**8)\n",
    "    nd=500*na#\n",
    "    if q==quantg :\n",
    "        w=w#\n",
    "        voltag=0.026*log(na*nd/w**2)#\n",
    "        print \"potential germanium   =   %0.2f\"%((voltag)),\"volt\"\n",
    "    \n",
    "    if q==quants:\n",
    "        w=w1#\n",
    "        voltag=0.026*log(na*nd/w**2)#\n",
    "        print \"potential silicon   =   %0.2f\"%((voltag)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 117 example 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "electrons density   =   9.62e+20 per cubic metre\n",
      "holes density   =   1.25e+23 per cubic metre\n"
     ]
    }
   ],
   "source": [
    "u=0.05##metre square per velocity second correction in the book\n",
    "un=0.13##metre square per velocity second\n",
    "condun=20##second per metre conductivity of n region\n",
    "condup=1000##second per metre conductivity of p region\n",
    "p=condup/(1.6*10**-19*u)#\n",
    "no=condun/(1.6*10**-19*un)#\n",
    "print \"electrons density   =   %0.2e\"%((no)),\"per cubic metre\"\n",
    "print \"holes density   =   %0.2e\"%((p)),\"per cubic metre\"#others to find is not in the book"
   ]
  }
 ],
 "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
}