1
00:00:00,360 --> 00:00:05,340
So now we can go ahead, and first of all, I want to define the current density.

2
00:00:06,270 --> 00:00:11,700
So we already defined you, the prefecture, and I told you that this is basically constant.

3
00:00:13,440 --> 00:00:21,480
So what we can do now is I could ride an if statement, for example, if the X coordinates of our vector

4
00:00:21,480 --> 00:00:32,850
aren't positioned Vector Square plus our one square and then the square root and P Dot Square roads

5
00:00:33,510 --> 00:00:39,990
is larger than zero, then it would be zero.

6
00:00:40,170 --> 00:00:45,150
So then we return an array, which is just zero.

7
00:00:48,360 --> 00:00:57,210
And in the other case, where opposition matter is at a point which has a radius smaller than zero,

8
00:00:57,570 --> 00:01:08,220
then we would return an array which only has a Z component and the Z component is then j0.

9
00:01:09,930 --> 00:01:16,500
However, I basically will make the problem here a bit more simple, and I will clean up the code more

10
00:01:16,800 --> 00:01:23,340
because I already told you, according to this equation, we would have to integrate the our dash over

11
00:01:23,340 --> 00:01:27,060
the whole space, and this will take a lot of time.

12
00:01:27,660 --> 00:01:33,450
However, we know that our current density is only non-zero in the wire, so we will only integrate

13
00:01:33,450 --> 00:01:35,040
over the z axis here.

14
00:01:35,820 --> 00:01:41,520
So basically, we we don't even consider the other points in space that are far away from two C axes.

15
00:01:42,030 --> 00:01:48,900
So this is why we will not not even have to use this if statement here we can just straight up return.

16
00:01:49,290 --> 00:01:50,610
That's the current density.

17
00:01:50,620 --> 00:01:55,890
Looks like this because we consider archeology only the wire.

18
00:01:57,180 --> 00:02:02,430
OK, but it wouldn't be a problem if you would include these three lines of code here, it would just

19
00:02:02,430 --> 00:02:04,200
make the code a tiny bit slower.

20
00:02:05,340 --> 00:02:05,820
OK.

21
00:02:05,850 --> 00:02:18,210
So what happens is when we call now our function for position vector on the z axis, for example, zero

22
00:02:18,210 --> 00:02:26,240
zero five, then we get our own because I didn't run the zone and now it works, OK.

23
00:02:26,470 --> 00:02:32,310
So if we are to position zero zero five, then our current density will be zero zero one, just as we

24
00:02:32,310 --> 00:02:32,910
programmed to.

25
00:02:35,130 --> 00:02:38,100
Now we must integrate.

26
00:02:38,700 --> 00:02:43,200
So to do this, we must first prepare some lists.

27
00:02:43,680 --> 00:02:56,520
And first I will prepare a coordinate list so the coordinates will be Kautz is equal to and p dot,

28
00:02:56,700 --> 00:02:57,030
right?

29
00:02:57,390 --> 00:03:02,250
So it will be an array, of course, and we can use know the mesh grid commands.

30
00:03:02,790 --> 00:03:10,200
This is something that we used already for plotting, for example, when we plotted a density plot where

31
00:03:10,200 --> 00:03:15,030
we had an x axis y axis and then the value for the z axis, which was a color.

32
00:03:15,570 --> 00:03:21,150
And to generate the array for the X and Y coordinates we have used and mesh grids.

33
00:03:21,930 --> 00:03:28,770
So now we can just define basically the lists for the values on the axes and then it will mesh and will

34
00:03:28,830 --> 00:03:30,630
fill, then the whole space.

35
00:03:31,500 --> 00:03:34,440
So we write, we mesh here.

36
00:03:38,450 --> 00:03:47,130
Be like this and total in space, and we start from minus cordone at Max.

37
00:03:47,640 --> 00:03:55,380
We go to cordon off Max and we have a certain number of points.

38
00:03:56,430 --> 00:04:02,940
So you see, I program this year in a flexible way so that we can adjust these values later on.

39
00:04:03,720 --> 00:04:10,950
And here I tested this before so that our code doesn't run forever and that we still get a nice convergence

40
00:04:10,950 --> 00:04:12,150
for the integral later on.

41
00:04:12,870 --> 00:04:19,470
So I choose these values here, and this is just the list for the x axis.

42
00:04:19,829 --> 00:04:24,810
Now we need another list for the y axis and we need another list for the z axis.

43
00:04:25,290 --> 00:04:32,040
However, I told you that we will only consider the X Y plane, so basically Z equals zero.

44
00:04:32,490 --> 00:04:34,080
So this means we don't need this here.

45
00:04:35,010 --> 00:04:40,500
We could, of course, use it to get a more accurate result for our particular problem, but I will

46
00:04:40,680 --> 00:04:43,590
only calculate it for the X y plane.

47
00:04:44,040 --> 00:04:47,790
So this is why I'm using here and zeroes one.

48
00:04:48,330 --> 00:04:53,640
So this will be just a array with a single value at zero.

49
00:04:55,170 --> 00:05:04,050
OK, so now we are finished with the coordinates and we can now test something, for example,

50
00:05:07,050 --> 00:05:15,210
codes and these arrays will have no many indices and I can show you what they do.

51
00:05:15,600 --> 00:05:18,800
First of all, these will be the coordinates X, Y and Z.

52
00:05:18,880 --> 00:05:24,180
So I want to plot all of them here and then we can write in some points.

53
00:05:25,560 --> 00:05:27,300
For example, divided by two.

54
00:05:29,910 --> 00:05:35,360
So here's a problem this is a marked down, so I would go to the next cell instead.

55
00:05:37,050 --> 00:05:44,470
No points divide it by two and then for the other index, also non-point, divided by two.

56
00:05:44,490 --> 00:05:48,600
And then for the Z value, we'll just take the only index that we have.

57
00:05:48,660 --> 00:05:49,170
Zero.

58
00:05:50,310 --> 00:05:53,220
So this will be the output for this particular point.

59
00:05:54,420 --> 00:05:58,950
So the index in this case would be 25 25 zero.

60
00:05:59,460 --> 00:06:05,010
And for the first index, we take all three, so basically going zero, one and two.

61
00:06:05,280 --> 00:06:06,330
And this is the output.

62
00:06:06,510 --> 00:06:11,940
The X coordinate that corresponds to this value is zero point one zero point one zero.

63
00:06:12,840 --> 00:06:13,290
It c.

64
00:06:13,290 --> 00:06:18,780
When we change this index, we get an arrow because we only have a single point in the Z direction.

65
00:06:19,410 --> 00:06:27,960
And here we can, for example, subtract one along the X direction and you see that there is a problem,

66
00:06:27,960 --> 00:06:33,630
but you see that this value here goes from plus zero point one to minus 0.1.

67
00:06:34,560 --> 00:06:39,090
However, here's a problem because actually I wanted to change here the X coordinate.

68
00:06:39,480 --> 00:06:46,440
However, the Y coordinate changed, and this is something that's very odd about and mesh grid, because

69
00:06:46,440 --> 00:06:55,650
if you take just two lists here, it will First Order or the the indexing will first be the y axis and

70
00:06:55,650 --> 00:06:56,700
then the x axis.

71
00:06:57,330 --> 00:07:00,060
And then when you take another one, then comes the z axis.

72
00:07:00,420 --> 00:07:02,100
So that's actually a very, very odd.

73
00:07:02,580 --> 00:07:11,400
So I can write down here so that you remember standard indexing is for whatever reason, I cannot tell

74
00:07:11,400 --> 00:07:12,990
you it makes no sense in my eyes.

75
00:07:13,320 --> 00:07:15,570
So not indexing is first.

76
00:07:15,570 --> 00:07:16,880
Why then x stanza?

77
00:07:16,890 --> 00:07:17,820
It makes no sense.

78
00:07:18,480 --> 00:07:19,830
However, we can fix this.

79
00:07:21,210 --> 00:07:22,380
Fixed by using

80
00:07:24,900 --> 00:07:28,830
indexing is equal to I.J.

81
00:07:28,860 --> 00:07:34,020
That's also something that I had to look up because I run into problems here because the indexing was

82
00:07:34,020 --> 00:07:36,660
incorrect so we can write it down like this.

83
00:07:37,110 --> 00:07:38,610
And now I know it should work.

84
00:07:39,180 --> 00:07:39,600
Yes.

85
00:07:40,350 --> 00:07:46,470
So for example, we can now write, print this one and then print another, output

86
00:07:49,530 --> 00:07:50,010
this one.

87
00:07:50,700 --> 00:07:52,950
And you see, these are our numbers.

88
00:07:53,490 --> 00:07:59,940
First output is minus zero point one zero point one zero and then zero point one zero point one zero.

89
00:08:01,440 --> 00:08:05,690
So this maybe also explains to you why I've chosen these values here.

90
00:08:06,060 --> 00:08:15,870
I explicitly wanted to exclude the values zero for X and zero for Y, and the reason is we will integrate

91
00:08:17,070 --> 00:08:22,200
our dash over the z axis were X and Y are both zero.

92
00:08:22,860 --> 00:08:29,160
So if we would consider X0 and y0 for our, then we would have the case where we divide by zero.

93
00:08:29,550 --> 00:08:31,530
And that's something you really have to avoid.

94
00:08:31,890 --> 00:08:35,870
And this is why I have not included Devalues zero.

95
00:08:35,940 --> 00:08:47,370
Here, so I'm going here in steps of two, as I'm sorry of 0.2, and we have a nicely dense array here

96
00:08:47,370 --> 00:08:50,190
of coordinates, but we exclude the point zero zero.

97
00:08:51,660 --> 00:08:54,270
Now we do the same thing for the vector potential.

98
00:08:56,990 --> 00:09:03,440
So first, we start with an empty array or empty list, and we can actually just copy this here and

99
00:09:03,440 --> 00:09:04,700
just give it a different name.

100
00:09:05,650 --> 00:09:06,680
A, for example.

101
00:09:08,390 --> 00:09:17,720
So now we have empty lists for the coordinates and as no, not not empty list for the coordinates,

102
00:09:17,720 --> 00:09:20,060
but these or any of these values of the coordinates.

103
00:09:20,360 --> 00:09:25,490
And for a actually, we don't need the same as for the coordinates, but we need an empty list.

104
00:09:25,730 --> 00:09:37,340
So instead of this one, I will write, I will write and peter the zeros and then number of points.

105
00:09:38,480 --> 00:09:46,490
This will be a list of length nom points where the values are all zeros at the same for the Y coordinates.

106
00:09:47,300 --> 00:09:50,360
And here, let's make this a bit nicer.

107
00:09:51,800 --> 00:09:52,820
Don't know what happened here?

108
00:09:54,440 --> 00:09:55,400
And here we go.

109
00:09:56,820 --> 00:10:05,120
OK, now we have it, and now we can, for example, check what we right here A and E.

110
00:10:05,490 --> 00:10:10,290
We should get three zeros in both cases because we haven't calculated a yet.

111
00:10:11,370 --> 00:10:13,050
OK, so now we have everything set up.

112
00:10:13,470 --> 00:10:15,120
Now we can do the integration.

