summaryrefslogtreecommitdiff
path: root/backup/Modern_Physics_version_backup/Chapter5.ipynb
blob: 331dc5312a68f900175d32284ca1887453900b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
 "metadata": {
  "name": "Chapter5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5: The Schrodinger Equation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2 Page 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "#parta\n",
      "from math import pi, sin\n",
      "import math\n",
      "from scipy import integrate\n",
      "h=1.05*10**-34;m=9.11*10**-31;L=10.0**-10;      # all the values are taken in SI units\n",
      "E1=h**2*pi**2/(2*m*L**2); E2=4*E1;            #Energies are calculated\n",
      "delE=(E2-E1)/(1.6*10**-19);                  #Difference in energy is converted to eV\n",
      "\n",
      "#result\n",
      "print \"Energy to be supplied in eV. is \",round(delE,3);\n",
      "\n",
      "#partb\n",
      "x1=0.09*10**-10;x2=0.11*10**-10                 #limits of the given region\n",
      "def integrand(x,L):\n",
      "    return 2.0/L*(sin(pi*x/L))**2\n",
      "\n",
      "probGnd=integrate.quad(integrand,x1,x2,args=(L))\n",
      "\n",
      "#result\n",
      "print \"The percentage probability of finding an electron in the ground state is \\n\",round(probGnd[0]*100,3);\n",
      "\n",
      "#partc\n",
      "k1=0.0;k2=0.25*10**-10;\n",
      "def integrand(k,L):\n",
      "    return 2.0/L*(sin(2*pi*k/L))**2\n",
      "\n",
      "probExc=integrate.quad(integrand,k1,k2,args=(L))\n",
      "\n",
      "#result\n",
      "print \"The probability of finding an electron in the excited state is\",round(probExc[0],3);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Energy to be supplied in eV. is  111.978\n",
        "The percentage probablility of finding an electron in the ground state is \n",
        "0.383\n",
        "The probablility of finding an electron in the excited state is 0.25\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}