1
00:00:00,330 --> 00:00:00,740
OK.

2
00:00:01,080 --> 00:00:08,730
So let us begin with programming, the wave function and the ion energies of an electron living in the

3
00:00:08,730 --> 00:00:11,160
box using Python three.

4
00:00:12,120 --> 00:00:18,330
So first of all, make sure you have these two import commands at the very beginning because we are

5
00:00:18,330 --> 00:00:23,700
going to plot some data and we are going to use NumPy for some calculations.

6
00:00:24,940 --> 00:00:31,230
Now next, we will define the potential and to Schrodinger equation and initiating a equation.

7
00:00:31,230 --> 00:00:36,990
We have the constants each bar and we have two constant m for the mass of the electron.

8
00:00:37,980 --> 00:00:43,080
And actually, these are very difficult numbers, and we want to make it more easy for us.

9
00:00:43,080 --> 00:00:45,120
So we just set them to one.

10
00:00:46,170 --> 00:00:51,060
And later on, we could scale our solution to fit the actual values of these constants.

11
00:00:51,600 --> 00:00:53,480
But this is not so important here.

12
00:00:53,490 --> 00:00:56,580
So typically people just set them to one.

13
00:00:58,170 --> 00:01:00,120
Now next, we will define our potential.

14
00:01:00,690 --> 00:01:07,620
And here we have our box, which goes from X equal zero to x equal.

15
00:01:08,670 --> 00:01:12,360
And for a we set the value, which will also be one in this case.

16
00:01:13,950 --> 00:01:18,450
Now the potential inside of the box, we we will set to zero.

17
00:01:18,750 --> 00:01:21,870
And outside of the box, the potential will be infinitely large.

18
00:01:22,710 --> 00:01:30,360
And this makes it a lot easier for us, as we have learned in the analytical case, because in fact,

19
00:01:30,360 --> 00:01:37,020
we only have to consider the area inside of the box because outside of the box, the potential is infinitely

20
00:01:37,020 --> 00:01:39,800
large and our wave function will be zero.

21
00:01:39,840 --> 00:01:41,970
So we don't have to actually define it here.

22
00:01:42,960 --> 00:01:47,220
The only thing that we need to define is the wave function.

23
00:01:47,220 --> 00:01:52,350
At the starting position, size is equal to zero.

24
00:01:53,730 --> 00:01:58,680
So actually, this is just the X dependent solution, so the stationary part.

25
00:01:59,280 --> 00:02:04,500
But still, I will call it SCI here, but in the energy killer case, we called it PHI.

26
00:02:05,850 --> 00:02:13,440
Now another thing at the very left of the box, we will have to also define a first derivative.

27
00:02:13,860 --> 00:02:16,260
So we call this deep sigh.

28
00:02:17,070 --> 00:02:22,080
And this is equal to a value which is different from zero.

29
00:02:23,040 --> 00:02:26,160
So far, it doesn't really matter how large this value is.

30
00:02:26,640 --> 00:02:34,770
We will just use some value and later on we will scale our wave function so that we will get the correct

31
00:02:34,770 --> 00:02:36,150
value for deep sigh.

32
00:02:36,750 --> 00:02:40,350
The only thing that's important to you is that it's different from zero.

33
00:02:41,670 --> 00:02:48,450
OK, so now we have to find some starting conditions, which means the value of science and the first

34
00:02:48,450 --> 00:02:52,380
derivative of psi at the left part of the box.

35
00:02:52,410 --> 00:02:54,810
So this means four x equal to zero.

36
00:02:55,980 --> 00:03:03,360
And now we have to propagate this differential equation, which is the stationary creating equation,

37
00:03:03,840 --> 00:03:10,050
so that we can calculate these two values for every other position inside of the box.

38
00:03:11,760 --> 00:03:15,240
So as I told you, we start at X equal to zero.

39
00:03:15,900 --> 00:03:18,990
And also we have to define some increment.

40
00:03:19,470 --> 00:03:28,080
So because we cannot solve to the way function continuously from zero to a, we have to define some

41
00:03:28,080 --> 00:03:31,470
value or some some increments, some steps.

42
00:03:32,190 --> 00:03:35,190
So I use here eight times.

43
00:03:36,550 --> 00:03:38,340
Let's let's use something like this.

44
00:03:38,760 --> 00:03:43,950
So we will have to do 1000 steps until we are at the other end of the box.

45
00:03:46,110 --> 00:03:50,670
Now what we also need is something to store our data.

46
00:03:51,420 --> 00:04:00,750
So we have here a list for our X will use, which will be empty in the beginning and also for the values

47
00:04:01,230 --> 00:04:03,030
of the way function.

48
00:04:03,990 --> 00:04:07,650
We could also use another list for for deep sigh.

49
00:04:08,070 --> 00:04:11,250
But actually, we are not really interested in this quantity.

50
00:04:11,910 --> 00:04:18,120
This is because even the wave function itself doesn't really have a meaning, but we can use the wave

51
00:04:18,120 --> 00:04:23,730
function to calculate observables and the probability density CI squared.

52
00:04:25,230 --> 00:04:25,620
OK.

53
00:04:25,950 --> 00:04:33,690
And now what we will use is a loop, or we use here such a wild statement.

54
00:04:34,320 --> 00:04:47,760
So what we are going to do is we will increase our value of X by D X until X reaches the value of A.

55
00:04:48,390 --> 00:04:51,390
So this means in the first loop X will be zero.

56
00:04:52,330 --> 00:04:57,810
The second loop X will be zero plus the X and then and so on.

57
00:04:57,840 --> 00:05:03,180
It will keep on increasing in increments of the X until and the last loop.

58
00:05:03,660 --> 00:05:05,400
It will be equal to a.

59
00:05:07,550 --> 00:05:07,880
Good.

60
00:05:08,060 --> 00:05:10,670
Now, what are we going to solve?

61
00:05:11,120 --> 00:05:19,580
We are going to solve the shooting equation and this means the second derivative of psi, so that's

62
00:05:19,580 --> 00:05:20,790
called it dead.

63
00:05:21,470 --> 00:05:31,160
So for a second derivative is equal to two times and over eight bar square.

64
00:05:33,830 --> 00:05:40,610
And then we can actually combine the potential, which is zero in this case.

65
00:05:41,540 --> 00:05:44,240
Time is the energy times psi.

66
00:05:44,660 --> 00:05:51,920
So if you would, yeah, bring this to the other side, you would see that is exactly minus h bar square.

67
00:05:51,920 --> 00:05:56,630
Over two m d deep psi is equal to E times.

68
00:05:56,760 --> 00:06:00,320
So this is exactly the stationary shooting equation for this case.

69
00:06:01,760 --> 00:06:08,800
OK, now we have some statement on how we can calculate deep psi.

70
00:06:10,760 --> 00:06:19,250
However, what we as so we cannot really use or we cannot calculate this derivative analytically, we

71
00:06:19,250 --> 00:06:20,840
could, but we don't want to do this here.

72
00:06:20,840 --> 00:06:22,370
We want to do it numerically.

73
00:06:23,330 --> 00:06:28,970
And there's actually the second derivative, and you can only calculate a second derivative from the

74
00:06:28,970 --> 00:06:29,990
first derivative.

75
00:06:30,530 --> 00:06:35,420
So before we can calculate the second derivative, we need to calculate the first derivative.

76
00:06:36,800 --> 00:06:43,110
And here we use deep CI is equal to DB ci.

77
00:06:44,930 --> 00:06:51,790
Plus the derivative of deep CI, which is the deep CI times v x.

78
00:06:52,640 --> 00:06:55,540
OK, now we have something for the first derivative of CI.

79
00:06:56,540 --> 00:06:59,480
This we can calculate from from CI itself.

80
00:06:59,720 --> 00:07:05,960
So CI is equal to CI plus deep CI times d x.

81
00:07:06,920 --> 00:07:12,710
So we have now and a new value of CI, which is calculated from the derivative times the increment.

82
00:07:13,790 --> 00:07:20,210
Then we have the first derivative, which is calculated from the second derivative times.

83
00:07:20,210 --> 00:07:26,900
The increment and the second derivative is related to the wave function itself by just creating an equation.

84
00:07:28,790 --> 00:07:33,530
OK, so now this shouldn't actually work already.

85
00:07:33,710 --> 00:07:44,630
What we need now is we we want to store our wax values, so we use here pens so that this value of X

86
00:07:45,440 --> 00:07:48,560
for each loop is stored in our X list.

87
00:07:48,830 --> 00:07:52,870
It will add a new entry and the same for sign.

88
00:07:55,070 --> 00:07:57,440
So again, pens sign.

89
00:07:59,440 --> 00:08:04,870
Now, what we want to also do is we want to plot.

90
00:08:06,820 --> 00:08:13,720
So this is the command for plots, so we plot X list versus scientists.

91
00:08:16,180 --> 00:08:22,570
And another thing that we also have to consider here, the only thing that is left that is not defined

92
00:08:22,570 --> 00:08:24,280
yet is the energy.

93
00:08:25,060 --> 00:08:30,100
And actually, we want to determine psi, but also we want to determine the energy.

94
00:08:30,820 --> 00:08:34,240
So just means so far we don't know what the energy is.

95
00:08:35,049 --> 00:08:36,940
But this is the whole trick of this method.

96
00:08:37,600 --> 00:08:40,360
We will just set some value for the energy.

97
00:08:40,510 --> 00:08:47,080
Let's say one, and we will just test what the wave function looks like for this energy that we have

98
00:08:47,080 --> 00:08:47,800
to find here.

99
00:08:48,370 --> 00:08:53,680
And then we will see if it looks reasonable in a physical way.

100
00:08:54,940 --> 00:08:59,380
So let me run this notebook and see what it looks like.

101
00:09:00,540 --> 00:09:02,100
So restart, run off.

102
00:09:02,280 --> 00:09:02,670
OK.

103
00:09:05,650 --> 00:09:11,320
OK, so here we have now our expel you and remember our box starts from zero.

104
00:09:11,770 --> 00:09:15,730
Where the wave functions should be zero because we have defined it here.

105
00:09:16,690 --> 00:09:23,050
And also we have some first derivative, which is different from zero, because here we have to find

106
00:09:23,050 --> 00:09:23,860
it's actually one.

107
00:09:24,610 --> 00:09:26,800
So this makes total sense.

108
00:09:26,800 --> 00:09:34,060
And then the wave function increases in, I would say, something like assign function, which also

109
00:09:34,060 --> 00:09:34,660
makes sense.

110
00:09:34,670 --> 00:09:35,860
So that's already good.

111
00:09:36,400 --> 00:09:44,980
But here at the other end of the box, which is X equal to a which we have set to one here, our wave

112
00:09:44,980 --> 00:09:46,570
function does not go back to zero.

113
00:09:47,050 --> 00:09:49,960
So it's in conflict with the other boundary condition.

114
00:09:51,010 --> 00:09:56,560
And this is, of course, the case because we have not told the code that there is a boundary condition.

115
00:09:58,090 --> 00:10:00,610
So let's try a different energy.

116
00:10:03,670 --> 00:10:11,710
OK, so two looks already a bit better, it starts to go down three four.

117
00:10:12,580 --> 00:10:14,510
OK, we are getting closer.

118
00:10:15,250 --> 00:10:15,910
Five.

119
00:10:16,690 --> 00:10:17,470
Oh, OK.

120
00:10:17,740 --> 00:10:18,970
This looks already pretty good.

121
00:10:19,090 --> 00:10:21,190
I mean, it's a bit lower than than one.

122
00:10:21,640 --> 00:10:25,240
Maybe it's something like four point nine.

123
00:10:25,750 --> 00:10:28,480
OK, yeah, that is actually pretty good.

124
00:10:29,110 --> 00:10:34,810
So now we could also look at the cyclist and go all the way down.

125
00:10:35,350 --> 00:10:44,470
So you see, we start here from zero point zero zero one and it goes back down to zero zero zero three

126
00:10:44,470 --> 00:10:44,760
five.

127
00:10:44,770 --> 00:10:46,300
OK, that's pretty good, actually.

128
00:10:47,360 --> 00:10:51,070
And that's the whole point of this method, which is called the shooting method.

129
00:10:51,790 --> 00:10:58,270
We give it an energy and then we just let the system take a shot and propagate the wave function.

130
00:10:58,270 --> 00:11:03,820
And if it looks reasonable, then everything is correct and we can say, OK, this is our first eigenvalue

131
00:11:04,450 --> 00:11:07,120
and this is our first I can function.

