{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 01 : Basic semiconductor and pn junction theory"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1, Page No 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Nd=3*10**14\n",
      "Na=0.5*10**14                       #all in atom/cm**3\n",
      "ni=1.5*10**10\n",
      "\n",
      "#Calculations\n",
      "print(\"resultant densities of free electrons and hole\")\n",
      "ne=(-(Na-Nd)+(math.sqrt(((Na-Nd)**2)+4*ni**2)))/2\n",
      "print(\"Electron densities = %.1f x 10^14 electron/cm**3\" %(ne/(10**14)))     #electron densities in electron/cm**3\n",
      "Nd>Na\n",
      "n=Nd-Na\n",
      "print(n)\n",
      "p=(ni**2)/n\n",
      "\n",
      "#Results\n",
      "\n",
      "print(\"densities of hole is =%.1f X 10^6 dhole/cm3\" %(p/(10**6)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resultant densities of free electrons and hole\n",
        "Electron densities = 2.5 x 10^14 electron/cm**3\n",
        "2.5e+14\n",
        "densities of hole is =0.9 X 10^6 dhole/cm3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2, Page No 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "l=1*10**-3\n",
      "E=10\n",
      "\n",
      "#Calculations\n",
      "un=1500*10**-4\n",
      "up=500*10-4\n",
      "Vn=-(un*E)/l\n",
      "\n",
      "#Results\n",
      "print(\"drift current is =%.2dm/s\\n\" %Vn)\n",
      "print(\"drift current of hole\")\n",
      "Vp=(up*E)/l\n",
      "print(\"drift current is =%.f dm/s\\n\" %(Vp/10**5))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "drift current is =-1500m/s\n",
        "\n",
        "drift current of hole\n",
        "drift current is =500 dm/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 Page No 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "l=1*10**-3\n",
      "a=0.1*10**-4\n",
      "ni=1.5*10**10\n",
      "p=1.5*10**10\n",
      "un=1500\n",
      "up=500           #in cm3/V.s\n",
      "q=1.6*10**-19\n",
      "\n",
      "#Calculations\n",
      "m=q*((ni*un)+(p*up))*10**6\n",
      "print( \"mobility is =%.1fmicro/ohmcm\" %m)\n",
      "R=l/(m*a)\n",
      "print(\" resistance is =%.1fMohm\" %R)\n",
      "\n",
      "#for doped material\n",
      "n=8*10**13\n",
      "p=(ni**2)/n\n",
      "m=q*((n*un)+(p*up))\n",
      "\n",
      "#Results\n",
      "print(\"mobility is =%3.4f/ohmcm\" %m)\n",
      "R=l/(m*a)\n",
      "print(\" resistance is %.2f Kohm\" %(R/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mobility is =4.8micro/ohmcm\n",
        " resistance is =20.8Mohm\n",
        "mobility is =0.0192/ohmcm\n",
        " resistance is 5.21 Kohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4, Page No 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "T1=25.0\n",
      "T2=35.0\n",
      "T3=45.0\n",
      "I0=30.0       # nA\n",
      "print(\"I0(35)=I0*2**(T2-T1)/10\")\n",
      "#on solving\n",
      "I035=I0*2**((T2-T1)/10)\n",
      "print(\"Current at 35c is =%.2f nA\\n\" %I035)\n",
      "print(\"I0(45)=I0*2**(T3-T1)/10\")\n",
      "#on solving\n",
      "I045=30*2**2\n",
      "print(\"current at 45c is =%.2f nA\\n\" %I045)\n",
      "I_CS=100.0 \n",
      "V_CC=200.0 \n",
      "t_on=40*10**-6"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "I0(35)=I0*2**(T2-T1)/10\n",
        "Current at 35c is =60.00 nA\n",
        "\n",
        "I0(45)=I0*2**(T3-T1)/10\n",
        "current at 45c is =120.00 nA\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5, Page No 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "I0=30\n",
      "Vd=0.7\n",
      "n=2\n",
      "\n",
      "#Calculations\n",
      "Vt=26.0*10**-3\n",
      "k=Vd/(n*Vt)\n",
      "Id=I0*((2.7**k)-1)*10**-6     #Junction current\n",
      "print(\" a) Forward bais current is =%.2f mA\\n\" %Id)\n",
      "Vd=-10                #reverse bais\n",
      "k=Vd/(n*Vt)\n",
      "Id=I0*((2.7**k)-1)\n",
      "\n",
      "#Results\n",
      "print(\" b) Forward bais current is =%.2f nA\" %Id)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a) Forward bais current is =19.23 mA\n",
        "\n",
        " b) Forward bais current is =-30.00 nA\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6, Page No 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Id=.1*10**-3\n",
      "n=2\n",
      "vt=26*10**-3\n",
      "I0=30*10**-9\n",
      "\n",
      "#Calculations\n",
      "Vd=(n*Vt)*math.log(Id/I0)*10**3\n",
      "print(\" a) Forward bais current is =%.2f mV\\n\" %Vd)\n",
      "Id=10*10**-3\n",
      "Vd=(n*Vt)*math.log(Id/I0)*10**3\n",
      "\n",
      "#Results\n",
      "print(\"b) forward bais current is %dmV\\n\" %Vd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a) Forward bais current is =421.81 mV\n",
        "\n",
        "b) forward bais current is 661mV\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}