1
00:00:00,230 --> 00:00:05,640
So in the previous lecture, we have seen that a cube explained function that's that is defined piece

2
00:00:05,640 --> 00:00:09,770
wise works very well for describing these data points.

3
00:00:09,840 --> 00:00:14,820
So the general trend of the data points is nicely reproduced by this function.

4
00:00:15,180 --> 00:00:19,950
And the good thing is that now we have the function that describes the trend of the data between the

5
00:00:19,950 --> 00:00:20,760
data points.

6
00:00:21,360 --> 00:00:28,500
So for example, if we want to calculate now some derivative at this point, we do not have to use these

7
00:00:28,500 --> 00:00:30,510
and these two points as the reference.

8
00:00:30,900 --> 00:00:37,350
But we can just take some small area near the point to calculate the derivative so it can be very,

9
00:00:37,350 --> 00:00:40,230
very helpful and it makes the life a lot easier.

10
00:00:41,370 --> 00:00:47,430
So these cubic lines, they work well and they have a continuous derivative at the data points.

11
00:00:47,940 --> 00:00:55,020
But so far, the data was very smooth, so it wasn't so difficult to generate this interpolation.

12
00:00:55,660 --> 00:00:59,310
So let's see what happens if we used to perturb data from here.

13
00:01:00,420 --> 00:01:06,060
So I will scroll down where we have left our notebook and now we come to the perturb data.

14
00:01:07,020 --> 00:01:16,240
And this time I will just basically copy what we had written down here, and then I will just paste

15
00:01:16,320 --> 00:01:18,210
it at the bottom where we have left.

16
00:01:19,230 --> 00:01:26,460
And this time I will write spline Kubik without the zero, because this time we will fit not the zero

17
00:01:26,460 --> 00:01:28,150
data, but the actual data.

18
00:01:28,170 --> 00:01:31,230
And of course, we will use a cubic methods.

19
00:01:32,520 --> 00:01:41,820
So now we use here once again such an ex list that we have to find previously, so we don't have to

20
00:01:41,820 --> 00:01:42,630
redefine it again.

21
00:01:42,630 --> 00:01:44,850
We can just write here ex list.

22
00:01:46,200 --> 00:01:46,860
And

23
00:01:49,830 --> 00:01:51,260
no, sorry, that was not correct.

24
00:01:51,300 --> 00:01:52,650
I wanted to change the other one.

25
00:01:55,110 --> 00:02:00,210
So this one or two data points, we leave them as they are, and then we just changed this plot.

26
00:02:00,450 --> 00:02:01,050
Exactly.

27
00:02:01,050 --> 00:02:07,050
So we use X list and then Blind Cubic X list.

28
00:02:09,570 --> 00:02:18,300
And then we can run it, and we see, OK, Rick's list is defined in an odd way, so we have to change

29
00:02:18,300 --> 00:02:18,510
it.

30
00:02:19,440 --> 00:02:20,520
So let me change it.

31
00:02:21,930 --> 00:02:33,570
Maybe let's go from minus four point five to four point five with nine hundred and one points so that

32
00:02:33,570 --> 00:02:34,610
it looks like this.

33
00:02:34,620 --> 00:02:37,170
So now you may wonder what is going on here.

34
00:02:37,170 --> 00:02:38,490
It looks a bit odd.

35
00:02:39,590 --> 00:02:50,970
Um, so I think, yeah, this is because we plot here the the unperturbed data and not the perturbed

36
00:02:50,970 --> 00:02:51,210
ones.

37
00:02:51,210 --> 00:02:52,640
So maybe let me do it like this.

38
00:02:52,650 --> 00:02:53,650
I will write your plot.

39
00:02:54,120 --> 00:02:56,370
So then now blue is the actual data.

40
00:02:57,090 --> 00:03:04,650
Orange is the blind fit of the new data, and I will know the plot, the new data as well.

41
00:03:05,340 --> 00:03:11,640
So let me do it like this and I will do it in a scatterplot.

42
00:03:13,200 --> 00:03:14,370
Yes, exactly.

43
00:03:14,700 --> 00:03:15,420
Now it looks good.

44
00:03:16,350 --> 00:03:25,530
So we have in blue the unperturbed data we have in the blue dots, the perturb data, and we have an

45
00:03:25,530 --> 00:03:30,030
orange, the cubic blind fitting the perturbed data.

46
00:03:30,780 --> 00:03:38,520
And do you see, as I mentioned earlier, every individual data point is really fitted, which can be

47
00:03:38,520 --> 00:03:43,680
good, but actually we call this in numeric that it is over fitted.

48
00:03:44,490 --> 00:03:52,200
So of course, if you think of it in terms of physics, then the physical dependence on a physical model

49
00:03:52,200 --> 00:03:55,090
behind it will, of course, never be so difficult here.

50
00:03:55,090 --> 00:03:57,090
It will not have all of these fluctuations.

51
00:03:57,540 --> 00:04:00,330
It's pretty, pretty clear that this is just noise.

52
00:04:01,050 --> 00:04:08,010
So what we would want here is we want to smooth these blind and we don't want every point to be fitted

53
00:04:08,010 --> 00:04:08,760
perfectly.

54
00:04:09,510 --> 00:04:17,250
And to do this, we will come to new methods in the next lecture, which is called We are fitting a

55
00:04:17,250 --> 00:04:18,089
model function.

56
00:04:18,630 --> 00:04:20,380
But I want to show you here that is.

57
00:04:20,459 --> 00:04:22,590
It is also possible with slides.

58
00:04:23,340 --> 00:04:26,350
However, we must use a different command this time.

59
00:04:26,370 --> 00:04:43,410
It's called interpolate and then it's called uni variance on line, and we must fit data zero and data

60
00:04:43,410 --> 00:04:43,770
one.

61
00:04:44,070 --> 00:04:46,260
And this time we don't use an optional argument.

62
00:04:46,260 --> 00:04:47,760
It works just as it is.

63
00:04:48,240 --> 00:04:51,180
And I recall this function supplying smooth.

64
00:04:52,650 --> 00:04:57,660
And let's see, maybe I have a typo.

65
00:04:57,690 --> 00:04:58,950
Yeah, here of a typo.

66
00:04:59,600 --> 00:05:05,130
Um, you need very splain.

67
00:05:05,760 --> 00:05:07,080
Maybe still a typo.

68
00:05:10,350 --> 00:05:14,230
You need to vary it with an A.

69
00:05:14,460 --> 00:05:15,480
Yeah, like this.

70
00:05:16,230 --> 00:05:23,220
Sorry about the type of A. works we have to command interplay the univariate splicing data zero and

71
00:05:23,220 --> 00:05:28,510
data one and restore this function and name it spline smooth.

72
00:05:30,000 --> 00:05:33,060
So now we can run this and we can plot it.

73
00:05:33,630 --> 00:05:39,030
So once again, let me copy this here without the first line.

74
00:05:39,510 --> 00:05:42,090
So now we plot the data.

75
00:05:43,240 --> 00:05:48,820
So actually, I would say we don't have to plot the initial data this time.

76
00:05:49,540 --> 00:05:50,800
We can just do it like this.

77
00:05:51,910 --> 00:06:00,520
Just plot the scatter data and then the updated function here, which is called splice moved.

78
00:06:02,650 --> 00:06:09,070
And if you compare this to the other plots, maybe it looks already a bit more smooth.

79
00:06:09,100 --> 00:06:12,760
For example, here you have this large peak, which is totally unreasonable.

80
00:06:13,300 --> 00:06:16,840
And here it is, almost gone, so it looks much better already.

81
00:06:17,770 --> 00:06:28,030
And to improve this, we can tune the smoothness factor so we can write splain smoothed dot set on a

82
00:06:28,060 --> 00:06:32,560
school smoothing on the score factor.

83
00:06:34,240 --> 00:06:36,820
Now we must specify some number, for example.

84
00:06:36,820 --> 00:06:37,350
50.

85
00:06:38,820 --> 00:06:42,280
See, it's even smoother if we go 500.

86
00:06:43,720 --> 00:06:45,670
And you see, it's very, very smooth.

87
00:06:45,670 --> 00:06:47,740
And this is exactly what we wanted.

88
00:06:48,610 --> 00:06:58,810
So you see, by controlling the smoothing factor, we you yeah, we basically disregards that every

89
00:06:58,810 --> 00:07:06,220
point must be fitted perfectly and we must just roughly fit all the points by, such as flying here.

90
00:07:06,730 --> 00:07:10,840
And you see, this is a much better function that describes the physics much better.

91
00:07:11,680 --> 00:07:13,720
But of course, it is not any more.

92
00:07:14,020 --> 00:07:18,210
A piece wise defines blind, so it is a bit of a different thing.

93
00:07:18,220 --> 00:07:24,280
And this is because we have called here to command univariate line, which is something different.

94
00:07:24,850 --> 00:07:28,090
But I want I don't want to go into more details here.

95
00:07:28,990 --> 00:07:33,430
I want to go straight to the next lecture where we will define a model function.

96
00:07:33,760 --> 00:07:40,390
And then we try to optimize the parameters so that this model of function describes what data best because

97
00:07:40,390 --> 00:07:47,500
this is typically the way physicists or I would say other scientists also fit some experimental data

98
00:07:47,950 --> 00:07:52,930
and disciplines are, of course, a very, very nice because they are a nice mathematical tool for fitting

99
00:07:52,930 --> 00:07:54,700
or for interpolating the data.

100
00:07:55,090 --> 00:08:00,700
But often they don't reproduce the correct mechanism that is behind the data.

101
00:08:01,540 --> 00:08:05,680
So I hope you stay tuned and let's go together into the next lecture.

