{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter1 - Vaccum Tubes and Semiconductors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1.1 Page No. : 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VAK2 = 300.00  volts\n",
      "VAK1 = 170.00  volts\n",
      "IA2 = 0.0020  ampere\n",
      "IA1 = 0.0000  ampere\n",
      "resistance,rP =(VAK2-VAK1)/(IA2-IA1)=65000.00  ohm\n",
      "VGK2 = -2.50  volts\n",
      "VGK1 = -1.50  volts\n",
      "VAK3 = 200.00  volts\n",
      "amplification factor,u =(VAK2-VAK1)/(VGK2-VGK1)=-100.00  unitless \n",
      "IA4 = 0.0022  ampere\n",
      "IA1 = 0.0005  ampere\n",
      "transconductance,gm =(IAK4-IAK3)/(VGK2-VGK3)=-0.00  ampere/volt \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#refer to fig 1.2(c) and given d.c operating points VGKQ=-2 V,VAKQ=250 V,IAQ=-1.2 mA\n",
    "VAK2=300\n",
    "print \"VAK2 = %0.2f\"%(VAK2),\" volts\" # value of anode voltage2 \n",
    "VAK1=170\n",
    "print \"VAK1 = %0.2f\"%(VAK1),\" volts\" # value of anode voltage1 \n",
    "IA2=2*10**(-3)\n",
    "print \"IA2 = %0.4f\"%(IA2),\" ampere\" # value of anode current2\n",
    "IA1=0*10**(-3)\n",
    "print \"IA1 = %0.4f\"%(IA1),\" ampere\" # value of anode current1\n",
    "rP=(VAK2-VAK1)/(IA2-IA1)#anode resistance at VGK=VGKQ\n",
    "print \"resistance,rP =(VAK2-VAK1)/(IA2-IA1)=%0.2f\"%(rP),\" ohm\" #calculation\n",
    "VGK2=-2.5\n",
    "print \"VGK2 = %0.2f\"%(VGK2),\" volts\" # value of grid voltage2 \n",
    "VGK3=-1.5\n",
    "print \"VGK1 = %0.2f\"%(VGK3),\" volts\" # value of grid voltage1\n",
    "VAK3=200\n",
    "print \"VAK3 = %0.2f\"%(VAK3),\" volts\" # value of anode voltage1 \n",
    "u=(VAK2-VAK3)/(VGK2-VGK3)#amplification factor at IA=IAQ\n",
    "print \"amplification factor,u =(VAK2-VAK1)/(VGK2-VGK1)=%0.2f\"%(u),\" unitless \" #calculation\n",
    "IA4=2.2*10**(-3)\n",
    "print \"IA4 = %0.4f\"%(IA4),\" ampere\" # value of anode current4\n",
    "IA3=0.5*10**(-3)\n",
    "print \"IA1 = %0.4f\"%(IA3),\" ampere\" # value of anode current1\n",
    "gm=(IA4-IA3)/(VGK2-VGK3)# transconductance at VAK=VAKQ\n",
    "print \"transconductance,gm =(IAK4-IAK3)/(VGK2-VGK3)=%0.2f\"%(gm),\" ampere/volt \" #calculation\n",
    "#mistake of negative sign for answers for u(amplification factor) and gm(transconductance)in book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_2 Page No. : 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d = 0.01 metre\n",
      "l = 0.02 metre\n",
      "L = 0.20 metre\n",
      "Va = 2000.00 volts\n",
      "Vd = 100.00 volts\n",
      "m = 9.11e-31 Kg\n",
      "q = 1.60e-19 coulomb\n",
      "horizontal beam velocity,Vx =(2*Va*q/m)**(0.5) metre/second\n",
      "horizontal beam velocity,Vx =(2*Va*q/m)**(0.5)= 2.65e+07  metre/second\n",
      "transit time,t1 =(l/Vx) second\n",
      "transit time,t1 =(l/Vx)= 7.55e-10  second\n",
      "vertical beam velocity,Vy =(q*Vd*l/d*m*Vx) metre/second\n",
      "vertical beam velocity,Vy =(q*Vd*l/d*m*Vx)= 2.65e+06  metre/second\n",
      "vertical displacement,D =((l*L*Vd)/(2*d*Va) metre\n",
      "vertical displacement,D =((l*L*Vd)/(2*d*Va)=0.02  metre\n",
      "sensitivity of CRT,S =(0.5*l*L)/(d*Va) metre/volt\n",
      "sensitivity of CRT,S =(0.5*l*L)/(d*Va)=2.0e-04  metre/volt\n"
     ]
    }
   ],
   "source": [
    "d=0.5*10**(-2)\n",
    "print \"d = %0.2f\"%(d),\"metre\" #initializing value of distance b/w plates\n",
    "l=2*10**(-2)\n",
    "print \"l = %0.2f\"%(l),\"metre\" #initializing value of length of plates\n",
    "L=20*10**(-2)\n",
    "print \"L = %0.2f\"%(L),\"metre\" #initializing value of distance b/w centre of plates and screen\n",
    "Va=2000\n",
    "print \"Va = %0.2f\"%(Va),\"volts\" ##initializing value ofanode voltage\n",
    "Vd=100\n",
    "print \"Vd = %0.2f\"%(Vd),\"volts\" #initializing value of deflecting voltage\n",
    "m=9.11*10**(-31)\n",
    "print \"m = %0.2e\"%(m),\"Kg\" #mass of electron\n",
    "q=1.6*10**(-19)\n",
    "print \"q = %0.2e\"%(q),\"coulomb\" #charge on an electron\n",
    "print \"horizontal beam velocity,Vx =(2*Va*q/m)**(0.5) metre/second\" #formula\n",
    "Vx =(2*Va*q/m)**(0.5)\n",
    "print \"horizontal beam velocity,Vx =(2*Va*q/m)**(0.5)= %0.2e\"%(Vx),\" metre/second\" #calculation\n",
    "print \"transit time,t1 =(l/Vx) second\" #formula\n",
    "t1=(l/Vx)\n",
    "print \"transit time,t1 =(l/Vx)= %0.2e\"%(t1),\" second\" #calculation\n",
    "print \"vertical beam velocity,Vy =(q*Vd*l/d*m*Vx) metre/second\" #formula\n",
    "Vy=((q*Vd*l)/(d*m*Vx))\n",
    "print \"vertical beam velocity,Vy =(q*Vd*l/d*m*Vx)= %0.2e\"%(Vy),\" metre/second\" #calculation\n",
    "print \"vertical displacement,D =((l*L*Vd)/(2*d*Va) metre\" #formula\n",
    "D =(l*L*Vd)/(2*d*Va)\n",
    "print \"vertical displacement,D =((l*L*Vd)/(2*d*Va)=%0.2f\"%(D),\" metre\" #calculation\n",
    "print \"sensitivity of CRT,S =(0.5*l*L)/(d*Va) metre/volt\" #formula\n",
    "S =(0.5*l*L)/(d*Va)\n",
    "print \"sensitivity of CRT,S =(0.5*l*L)/(d*Va)=%0.1e\"%(S),\" metre/volt\" #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1-3 Page No. : 11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = 9.11e-31  Kg\n",
      "q = 1.60e-19  coulomb\n",
      "B = 1.50e-03 wb/m**2\n",
      "l = 0.05  metre\n",
      "L = 0.30  metre\n",
      "Va = 10000.00  volts\n",
      "horizontal beam velocity,Vx =(2*Va*q/m)**(0.5) metre/second\n",
      "horizontal beam velocity,Vx =(2*Va*q/m)**(0.5)= 5.93e+07  metre/second\n",
      "radius,r =(m*Vx)/(B*q) metre\n",
      "radius,r =(m*Vx)/(B*q)= 0.22  metre\n",
      "deflection,D =(L*l)/r) metre\n",
      "deflection,D =(L*l)/r)=0.07  metre\n"
     ]
    }
   ],
   "source": [
    "m=9.11*10**(-31)\n",
    "print \"m = %0.2e\"%(m),\" Kg\" #mass of electron\n",
    "q=1.6*10**(-19)\n",
    "print \"q = %0.2e\"%(q),\" coulomb\" #charge on an electron\n",
    "B=1.5*10**(-3)\n",
    "print \"B = %0.2e\"%(B)+ \" wb/m**2\" #initializing value of magnetic field\n",
    "l=5*10**(-2)\n",
    "print \"l = %0.2f\"%(l),\" metre\" #initializing axial length of magnetic field\n",
    "L=30*10**(-2)\n",
    "print \"L = %0.2f\"%(L),\" metre\" #initializing value of distance of screen from centre of magnetic field\n",
    "Va=10000\n",
    "print \"Va = %0.2f\"%(Va),\" volts\" ##initializing value of anode voltage\n",
    "print \"horizontal beam velocity,Vx =(2*Va*q/m)**(0.5) metre/second\" #formula\n",
    "Vx =(2*Va*q/m)**(0.5)\n",
    "print \"horizontal beam velocity,Vx =(2*Va*q/m)**(0.5)= %0.2e\"%(Vx),\" metre/second\" #calculation\n",
    "print \"radius,r =(m*Vx)/(B*q) metre\" #formula\n",
    "r =(m*Vx)/(B*q)\n",
    "print \"radius,r =(m*Vx)/(B*q)= %0.2f\"%(r),\" metre\" #calculation\n",
    "print \"deflection,D =(L*l)/r) metre\" #formula\n",
    "D =(L*l)/r\n",
    "print \"deflection,D =(L*l)/r)=%0.2f\"%(D),\" metre\" #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example -1.4 Page No. : 12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "q = 1.60e-19 coulomb\n",
      "I = 10.00 Ampere\n",
      "radius,r = 64.25  mils\n",
      "r1 = 0.00  metre\n",
      "n = 5.00e+28  electrons/m**3\n",
      "cross sectional area,A =(pi*r1**2)= 8.37e-06  square metre\n",
      "drift velocity,v=(I)/(A*q*n)=1.49e-04  metre/second\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "q=1.6*10**(-19)\n",
    "print \"q = %0.2e\"%(q),\"coulomb\" #charge on an electron\n",
    "I=10\n",
    "print \"I = %0.2f\"%(I),\"Ampere\" #initializing value of current\n",
    "r=64.25\n",
    "print \"radius,r = %0.2f\"%(r),\" mils\" #initializing value of radius of wire\n",
    "def mils2metres(mils):\n",
    "    metres=(mils*2.54)/(1000*100)\n",
    "    return metres\n",
    "r1=mils2metres(r)   \n",
    "print \"r1 = %0.2f\"%(r1),\" metre\"\n",
    "n=5*10**(28)\n",
    "print \"n = %0.2e\"%(n),\" electrons/m**3\" # electrons concentration in copper\n",
    "A=(pi*r1**2) #formulae                            \n",
    "print \"cross sectional area,A =(pi*r1**2)= %0.2e\"%(A),\" square metre\" #calculation\n",
    "v=(I)/(A*q*n)#formulae(I=A*q*n*v)\n",
    "print \"drift velocity,v=(I)/(A*q*n)=%0.2e\"%(v),\" metre/second\" #calculation\n",
    "\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_5 Page No. : 12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cross sectional area,A =1.00e-05 merer square\n",
      "resitivity(rho),p1 =1.00e-04  ohm-m\n",
      "resitivity(rho),p2 =1000.00  ohm-m\n",
      "resitivity(rho),p3 =1.00e+10  ohm-m\n",
      "conductor length,l =0.01  metre\n",
      " resistance for copper,R = p1*l/A = 0.10 ohm\n",
      " resistance for silicon,R = p2*l/A = 1.00e+06 ohm\n",
      " resistance for glass,R = p3*l/A = 1.00e+13 ohm\n"
     ]
    }
   ],
   "source": [
    "A=10*10**(-6)\n",
    "p1=10**(-4)\n",
    "p2=10**(3)\n",
    "p3=10**(10)\n",
    "l=1*10**(-2)# #initializations\n",
    "print \"cross sectional area,A =%0.2e\"%(A),\"merer square\" \n",
    "print \"resitivity(rho),p1 =%0.2e\"%(p1),\" ohm-m\"\n",
    "print \"resitivity(rho),p2 =%0.2f\"%(p2),\" ohm-m\"\n",
    "print \"resitivity(rho),p3 =%0.2e\"%(p3),\" ohm-m\"\n",
    "print \"conductor length,l =%0.2f\"%(l),\" metre\"\n",
    "print \" resistance for copper,R = p1*l/A = %0.2f\"%(p1*l/A),\"ohm\" #calculations for copper\n",
    "print \" resistance for silicon,R = p2*l/A = %0.2e\"%(p2*l/A),\"ohm\" #calculations for silicon\n",
    "print \" resistance for glass,R = p3*l/A = %0.2e\"%(p3*l/A),\"ohm\" #calculations for glass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_6 Page No. : 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I = 1.00e-06 Ampere\n",
      "intrinsic charge concentration,ni = 1.45e+10  /centimetre cube\n",
      "silicon atoms concntration, nV = 5.00e+22  /centimetre cube \n",
      "electron mobility,un = 1500.00  cm.sq/V-s\n",
      "hole mobility,up = 475.00 cm.sq/V-s\n",
      "temperature,T = 300.00 K\n",
      "q = 1.59e-19 coulomb\n",
      "cross sectional area,A =2.50e-05 cm square\n",
      "conductor length,l =0.01 cm\n",
      "relative concentration,N =nV/ni= 3.45e+12  silicon atoms per electron -hole pair\n",
      "intrinsic conductivityi,sigma =(1.59*10**(-19)*(1.45*10**10)*(1500+0475))= 0.00  (ohm-cm)**-1\n",
      "resitivity(rho),pi =(1/sigma)=2.20e+05  ohm-cm\n",
      " resistance for silicon,R =((2.22*10**5*0.5)/0.000025) = 4.44e+09  ohm\n",
      " voltage drop,V =I*R = 4440.00  V\n"
     ]
    }
   ],
   "source": [
    "ni = 1.45*10**10 #initializations\n",
    "nV = 5*10**22 #initializations\n",
    "un = 1500 #initializations\n",
    "up = 475#initializations\n",
    "T = 300 #initializations\n",
    "I=10**(-6)\n",
    "print \"I = %0.2e\"%(I),\"Ampere\" #initializing value of current\n",
    "A=(50*10**(-4))**2# l=0.5 #initializations\n",
    "q=1.59*10**(-19) #charge on an electron\n",
    "print \"intrinsic charge concentration,ni = %0.2e\"%(ni),\" /centimetre cube\"\n",
    "print \"silicon atoms concntration, nV = %0.2e\"%(nV),\" /centimetre cube \"\n",
    "\n",
    "print \"electron mobility,un = %0.2f\"%(un),\" cm.sq/V-s\"\n",
    "print \"hole mobility,up = %0.2f\"%(up),\"cm.sq/V-s\"\n",
    "print \"temperature,T = %0.2f\"%(T),\"K\"\n",
    "print \"q = %0.2e\"%(q),\"coulomb\" #charge on an electron\n",
    "print \"cross sectional area,A =%0.2e\"%(A),\"cm square\" \n",
    "print \"conductor length,l =%0.2f\"%(l),\"cm\"\n",
    "N=nV/ni\n",
    "print \"relative concentration,N =nV/ni= %0.2e\"%(N),\" silicon atoms per electron -hole pair\" #calculation\n",
    "sigma=(1.59*10**(-19)*(1.45*10**10)*(1500+475))\n",
    "print \"intrinsic conductivityi,sigma =(1.59*10**(-19)*(1.45*10**10)*(1500+0475))= %0.2f\"%(sigma),\" (ohm-cm)**-1\" #calculation\n",
    "pi =(1/sigma)#formulae\n",
    "print \"resitivity(rho),pi =(1/sigma)=%0.2e\"%(pi),\" ohm-cm\" #calculation\n",
    "R=(2.22*10**5*0.5)/0.000025\n",
    "print \" resistance for silicon,R =((2.22*10**5*0.5)/0.000025) = %0.2e\"%(R),\" ohm\" #calculations for silicon\n",
    "V=I*R\n",
    "print \" voltage drop,V =I*R = %0.2f\"%(V),\" V\" #calculations "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_7 Page No. : 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I = 1.00e-06 Ampere\n",
      "intrinsic charge concentration,ni = 1.45e+10  /centimetre cube\n",
      "silicon atoms concntration, nV = 5.00e+22  /centimetre cube \n",
      "electron mobility,un = 1500.00  cm.sq/V-s\n",
      "hole mobility,up = 317.00  cm.sq/V-s\n",
      "temperature,T = 300.00  K\n",
      "q = 0.00 coulomb\n",
      "cross sectional area,A =0.00  cm square\n",
      "conductor length,l =0.01  cm\n",
      "donor concentration,nD= nV/10**6=50000000000000000.00  /cm.cube\n",
      "resulting mobile electron concentration,nn= nD=5.00e+16  /cm.cube\n",
      "resulting hole concentration,pn= ni**2/nD=4.20e+03  /cm.cube\n",
      "n-type semiconductor conductivity,sigma=q*nD*un= 11.93  (ohm-cm)**-1\n",
      "doped silicon resitivity(rho),pn =(1/sigma)=0.08  ohm-cm\n",
      " resistance for silicon,R =((0.084*0.5)/A) = 1680.00  ohm\n",
      " voltage drop,V =I*R = 1.68e-03  V\n"
     ]
    }
   ],
   "source": [
    "ni = 1.45*10**10 #initializations\n",
    "nV = 5*10**22 #initializations\n",
    "un = 1500 #initializations\n",
    "up = 0475#initializations\n",
    "T = 300 #initializations\n",
    "I=10**(-6)\n",
    "print \"I = %0.2e\"%(I),\"Ampere\" #initializing value of current\n",
    "A=(50*10**(-4))**2# l=0.5 #initializations\n",
    "q=1.59*10**(-19) #charge on an electron\n",
    "print \"intrinsic charge concentration,ni = %0.2e\"%(ni),\" /centimetre cube\"\n",
    "print \"silicon atoms concntration, nV = %0.2e\"%(nV),\" /centimetre cube \"\n",
    "\n",
    "print \"electron mobility,un = %0.2f\"%(un),\" cm.sq/V-s\"\n",
    "print \"hole mobility,up = %0.2f\"%(up),\" cm.sq/V-s\"\n",
    "print \"temperature,T = %0.2f\"%(T),\" K\"\n",
    "print \"q = %0.2f\"%(q),\"coulomb\" #charge on an electron\n",
    "print \"cross sectional area,A =%0.2f\"%(A),\" cm square\" \n",
    "print \"conductor length,l =%0.2f\"%(l),\" cm\"\n",
    "nD=nV/10**6#formulae\n",
    "print \"donor concentration,nD= nV/10**6=%0.2f\"%(nD),\" /cm.cube\" #calculation\n",
    "nn=nD#formulae\n",
    "print \"resulting mobile electron concentration,nn= nD=%0.2e\"%(nn),\" /cm.cube\" #calculation\n",
    "pn= ni**2/nD#formulae\n",
    "print \"resulting hole concentration,pn= ni**2/nD=%0.2e\"%(pn),\" /cm.cube\" #calculation\n",
    "sigma=q*nD*un#formulae\n",
    "print \"n-type semiconductor conductivity,sigma=q*nD*un= %0.2f\"%(sigma),\" (ohm-cm)**-1\" #calculation\n",
    "pn =(1/sigma)\n",
    "print \"doped silicon resitivity(rho),pn =(1/sigma)=%0.2f\"%(pn),\" ohm-cm\" #calculation\n",
    "R=(0.084*0.5)/A\n",
    "print \" resistance for silicon,R =((0.084*0.5)/A) = %0.2f\"%(R),\" ohm\" #calculations for silicon\n",
    "V=I*R\n",
    "print \" voltage drop,V =I*R = %0.2e\"%(V),\" V\" #calculations "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_8 Page No. : 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "q = 1.59e-19 coulomb\n",
      "dimension of semiconductor,d=0.04  cm\n",
      "cross sectional area,A =d**2=1.37e-03  cm square\n",
      "thickness,x =1.00e-04  cm\n",
      "thickness,x0 =0  cm\n",
      "hole concentration at x,p= 9.22e+15  /cm-cube\n",
      "hole concentration at x0,p0= 0  /cm-cube\n",
      " change in concentration at ,dp= 9.22e+15  /cm-cube\n",
      "change in thickness,dx= 1.00e-04  cm\n",
      " slope,(dp/dx) =(p-p0)/(x-x0)=9.22e+19  holes/cm-cube\n",
      "hole diffusion constant,Dp= 12.00  cm-sq/s\n",
      " hole diffusion current,Ip =A*q*Dp*(dp/dx)=0.24  ampere\n"
     ]
    }
   ],
   "source": [
    "q=1.59*10**(-19) #charge on an electron\n",
    "print \"q = %0.2e\"%(q),\"coulomb\" #charge on an electron\n",
    "d=0.037\n",
    "print \"dimension of semiconductor,d=%0.2f\"%(d),\" cm\"\n",
    "A=(d**2) #area formulae for square shaped semiconductor\n",
    "print \"cross sectional area,A =d**2=%0.2e\"%(A),\" cm square\" \n",
    "x=10**(-4)\n",
    "print \"thickness,x =%0.2e\"%(x),\" cm\"\n",
    "x0=0\n",
    "print \"thickness,x0 =%0.f\"%(x0),\" cm\"\n",
    "p=9.22*10**(15)#\n",
    "print \"hole concentration at x,p= %0.2e\"%(p),\" /cm-cube\" #calculation\n",
    "p0=0#\n",
    "print \"hole concentration at x0,p0= %0.f\"%(p0),\" /cm-cube\" #calculation\n",
    "dp=(p-p0)#formulae\n",
    "dx=(x-x0)#formulae\n",
    "print \" change in concentration at ,dp= %0.2e\"%(dp),\" /cm-cube\" #calculation\n",
    "print \"change in thickness,dx= %0.2e\"%(dx),\" cm\" #calculation\n",
    "(dp/dx)==(p-p0)/(x-x0)#formulae\n",
    "print \" slope,(dp/dx) =(p-p0)/(x-x0)=%0.2e\"%(dp/dx),\" holes/cm-cube\" #calculation\n",
    "Dp=12\n",
    "print \"hole diffusion constant,Dp= %0.2f\"%(Dp),\" cm-sq/s\" #calculation\n",
    "Ip=A*q*Dp*(dp/dx)\n",
    "print \" hole diffusion current,Ip =A*q*Dp*(dp/dx)=%0.2f\"%(Ip),\" ampere\" #calculation"
   ]
  }
 ],
 "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
}