1
00:00:00,420 --> 00:00:06,420
So now we will consider a curl into divergence for this example, function vector are divided by Ah,

2
00:00:06,990 --> 00:00:14,340
and I've programmed this already here and we can have a look at the figure once again.

3
00:00:14,370 --> 00:00:17,010
So you see, it's along the radial direction, always.

4
00:00:17,430 --> 00:00:21,360
And now let's go ahead and calculate the divergence and the curl.

5
00:00:22,650 --> 00:00:32,330
So the definition of the divergence of G at the position R and H, so this will be the step size again.

6
00:00:32,340 --> 00:00:36,060
And these are three arguments that we always must provide.

7
00:00:36,870 --> 00:00:45,000
And as previously, I will just label these components of art as X, Y and Z, and then I can just go

8
00:00:45,000 --> 00:00:53,370
ahead and calculate the G X D X. So this will be the partial derivative of the X component of G.

9
00:00:53,640 --> 00:00:54,630
With respect to X.

10
00:00:55,530 --> 00:00:58,560
And so this will once again be a central difference as methods.

11
00:00:59,670 --> 00:01:00,720
This will be G

12
00:01:03,660 --> 00:01:06,450
four and P Dot Parade.

13
00:01:06,990 --> 00:01:12,540
So now we must provide the vector of the position, which will be initially X, Y and Z.

14
00:01:13,800 --> 00:01:21,360
And since we want to have here the X component of G, we must now use something like this.

15
00:01:21,370 --> 00:01:28,270
So we accessed the first component and now we do central differences with respect to X.

16
00:01:28,290 --> 00:01:36,570
So we write plus h for the X component, and then we copy the same thing minus and minus h.

17
00:01:36,960 --> 00:01:40,210
And we divide it by two times h.

18
00:01:41,640 --> 00:01:50,670
And now we do the other two terms, which will be g y DUI and GC DC.

19
00:01:52,050 --> 00:01:57,330
So now we must just be careful to shift here to h for the central differences.

20
00:01:58,680 --> 00:02:06,390
But not only that, we must also change here the index from here to the Y component for this one and

21
00:02:06,390 --> 00:02:09,120
two, the Z component and here as well.

22
00:02:10,259 --> 00:02:11,940
So now we have the individual terms.

23
00:02:12,120 --> 00:02:20,810
Let me show you again these ones here g x the X G Y de Y GC DC.

24
00:02:20,850 --> 00:02:23,910
And so for the divergence, we have to add these three up.

25
00:02:25,740 --> 00:02:28,560
So I return

26
00:02:31,710 --> 00:02:45,720
on d g x d x plus DG y d y plus DG, C D C, and then we can check what is the value for our specific

27
00:02:45,720 --> 00:02:46,260
position.

28
00:02:46,800 --> 00:02:51,780
Then we have to find to be 0.5, minus 1.2 and minus eight.

29
00:02:51,870 --> 00:02:53,040
Just some random numbers.

30
00:02:54,600 --> 00:02:55,650
This would be that.

31
00:02:56,730 --> 00:03:01,830
And when we compare it with the analytical solution, which is actually pretty difficult to get when

32
00:03:01,830 --> 00:03:05,730
you have never done it before, the analytical solution gives us

33
00:03:10,920 --> 00:03:11,490
this number.

34
00:03:12,720 --> 00:03:15,710
So once again, we have a pretty high accuracy.

35
00:03:15,720 --> 00:03:22,440
You see, at some points after the dots, there is some difference, but we can of course, improve

36
00:03:22,440 --> 00:03:28,290
this by just increasing or sorry, by decreasing the step size and then we increase the accuracy.

37
00:03:29,040 --> 00:03:31,140
But I think this is really sufficient.

38
00:03:31,180 --> 00:03:32,860
And yeah, it works.

39
00:03:32,880 --> 00:03:34,590
We have implemented the divergence.

40
00:03:36,020 --> 00:03:44,040
And now for the curl, the curl is actually pretty similar to the divergence because we must just calculate

41
00:03:44,040 --> 00:03:45,510
the other partial derivatives.

42
00:03:45,540 --> 00:03:51,210
So for example, GC, D, Y, G, Y, DC and so on and so on.

43
00:03:51,510 --> 00:03:56,460
And then we must construct three components and calculate these differences here.

44
00:03:57,750 --> 00:04:00,740
So this is really nothing special.

45
00:04:00,750 --> 00:04:07,020
It's very similar actually to this one, but it's a bit more work to write everything down.

46
00:04:08,100 --> 00:04:13,860
So for this reason, I will now just stop the video and write it down.

47
00:04:13,860 --> 00:04:17,820
And then if you want, you can write it in your own notebook as well.

48
00:04:18,029 --> 00:04:19,140
So see you in a second.

49
00:04:19,470 --> 00:04:23,340
So you see pretty similar to the divergence I have now created to curl.

50
00:04:23,670 --> 00:04:30,300
Once again, I've labeled X, Y and Z, and I have created the six remaining partial derivatives.

51
00:04:30,420 --> 00:04:36,420
So for example, G X DUI, G X DC and so on and so on.

52
00:04:36,420 --> 00:04:37,860
So all these mixed terms.

53
00:04:38,940 --> 00:04:47,080
And for example, to calculate the derivative of G X with respect to why we must take the X components.

54
00:04:47,080 --> 00:04:49,470
So here the component index will be zero.

55
00:04:49,890 --> 00:04:58,170
And since we derive with respect to why we must add the H to Y and subtract the H from Y, and then

56
00:04:58,170 --> 00:04:59,760
you do the same thing for the other.

57
00:04:59,880 --> 00:05:04,980
Five components, and then you must have a look at how the gradient.

58
00:05:05,440 --> 00:05:09,510
I'm sorry, sorry, how the curl is constructed.

59
00:05:09,930 --> 00:05:15,390
This is just by taking these three components here and you always pairwise subtract them.

60
00:05:16,110 --> 00:05:20,280
And for the X component, you calculate GC.

61
00:05:21,090 --> 00:05:24,990
So DGC the Y minus the GeoEye DC.

62
00:05:25,820 --> 00:05:33,330
And this is why I let the GC the y minus DG y these c, so exactly what I just said.

63
00:05:34,080 --> 00:05:40,320
And then, of course, for the other components, you do the same thing and you see already the analytical

64
00:05:40,320 --> 00:05:43,860
solution tells us that this is zero for every point in space.

65
00:05:43,860 --> 00:05:45,780
So let's see if this really is true.

66
00:05:46,980 --> 00:05:51,060
G ah, and h, yes, indeed.

67
00:05:51,240 --> 00:05:58,260
So you see, there's a some value times 10 to the power of minus 12, 12, 13, so this is essentially

68
00:05:58,260 --> 00:05:58,830
zero.

69
00:06:00,060 --> 00:06:05,370
So I hope you're not disappointed that this example didn't give us such a cool result for the curl.

70
00:06:05,730 --> 00:06:12,640
But actually in the next section where we will discuss integration, I will in the end consider a really

71
00:06:12,640 --> 00:06:19,200
a physical example where we will calculate the magnetic fields of a charged wire.

72
00:06:19,800 --> 00:06:25,020
And there we will first calculate a so-called vector potential using the integral method that we will

73
00:06:25,020 --> 00:06:26,370
establish in the next section.

74
00:06:26,820 --> 00:06:33,000
And thereafter, we must calculate the magnetic field from this vector potential and this we do by calculating

75
00:06:33,000 --> 00:06:33,570
the curl.

76
00:06:34,260 --> 00:06:40,170
So in the next section, there will be a nice exercise for practicing how to calculate the curl where

77
00:06:40,170 --> 00:06:43,920
the result will something will be something different to zero.

78
00:06:44,790 --> 00:06:47,640
So are you still excited and I see you in the next lecture?

