1
00:00:00,060 --> 00:00:07,890
So now we will go away from the mathematical blinds and instead we will try to choose the ideal parameters

2
00:00:08,340 --> 00:00:13,790
of a physically motivated model functions such that some area is minimized.

3
00:00:14,320 --> 00:00:17,310
That sounds a bit cryptic, so let's go to an example.

4
00:00:18,120 --> 00:00:24,270
So we have previously defined the detail, for example, this one that we tried to fit in some way,

5
00:00:24,840 --> 00:00:31,200
and we know already that we have created the data with some polynomial function and some thermal fluctuations,

6
00:00:31,200 --> 00:00:32,159
some random numbers.

7
00:00:32,610 --> 00:00:37,920
And so by just looking at the data, I think it is reasonable that you would assume that this could

8
00:00:37,920 --> 00:00:41,700
be a polynomial function that describes the data.

9
00:00:42,300 --> 00:00:47,490
Also, since it's an odd function, it must be an odd power for the highest power.

10
00:00:48,090 --> 00:00:51,780
And yeah, it looks not so difficult.

11
00:00:51,780 --> 00:00:55,500
So I think it's reasonable to assume that this is a third order polynomial.

12
00:00:55,950 --> 00:01:01,470
But in general, we could say, let's use some polynomial function to fit the data.

13
00:01:02,220 --> 00:01:09,540
So I wrote down that our model function is at the polynomial f of X is a zero plus a one times X to

14
00:01:09,540 --> 00:01:14,430
the power of one plus a two times x two and then more and more terms.

15
00:01:14,760 --> 00:01:21,240
So we can say this is a sum where the index case starts from zero goes to sum end, so maximum value.

16
00:01:21,570 --> 00:01:28,380
And then the terms are just these evolution coefficients a k and then we have these polynomial x to

17
00:01:28,380 --> 00:01:29,280
the power of K.

18
00:01:30,330 --> 00:01:34,710
So for two stars, let us define such a model function in general.

19
00:01:35,520 --> 00:01:44,820
So I will write definition of a polynomial model and we need X and we need support coefficients.

20
00:01:45,570 --> 00:01:51,380
So of course, we could say we defined the coefficients and then just define our polynomials.

21
00:01:51,390 --> 00:01:58,470
We don't put it as an argument here, but we want what we want to try to do is we want to fit these

22
00:01:58,470 --> 00:01:59,130
parameters.

23
00:01:59,160 --> 00:02:00,930
This is the whole purpose of the methods.

24
00:02:01,470 --> 00:02:06,510
So these are the things that we try to change and that we try to optimize.

25
00:02:07,020 --> 00:02:13,140
And therefore it's a very good idea to define the function with the h-he's as the arguments.

26
00:02:14,250 --> 00:02:18,930
And we don't have to define every of these coefficients individually.

27
00:02:19,290 --> 00:02:25,230
We can just define this as an array and this array can be of variable size.

28
00:02:25,830 --> 00:02:31,380
So you see, we can just go ahead now and define or program this sum here.

29
00:02:31,380 --> 00:02:40,680
So as previously, we just say T is zero that we make a loop for K and range O.

30
00:02:40,680 --> 00:02:43,560
We could then say, for example, length of P.

31
00:02:44,310 --> 00:02:53,310
So this means if I were a A-rated, we give for the polynomials has four terms, then this loop will

32
00:02:53,310 --> 00:03:00,540
be run four times and we will then say T will be updated old T plus.

33
00:03:01,110 --> 00:03:08,070
And then we just say use the case elements of the array of eight and multiply it by X to the power of

34
00:03:08,070 --> 00:03:08,400
K.

35
00:03:08,530 --> 00:03:10,200
So this is exactly what's written here.

36
00:03:11,070 --> 00:03:14,460
And then, of course, return the value of T.

37
00:03:16,050 --> 00:03:24,990
And if we now say our starting point for these is will be a zero, which is and three and tier I use

38
00:03:24,990 --> 00:03:28,980
known to the coefficients that we have used for our function from the beginning.

39
00:03:29,400 --> 00:03:39,420
So like minus two two point four minus 0.5 and minus zero point three five, then we can go ahead and

40
00:03:39,420 --> 00:03:55,590
plot this so we can just say T Dot X Label X to Y Label Y and then X list.

41
00:03:56,100 --> 00:03:57,720
So let's redefine the X list.

42
00:03:57,720 --> 00:04:05,050
I think we have overwritten it at some point, so let's just redefine it in space minus five to five.

43
00:04:05,070 --> 00:04:09,630
This is what we have chosen in the beginning and the number of points we called end points.

44
00:04:10,830 --> 00:04:23,580
And then we can finally plot it's plotted or plots x list come out and then purely nominal model of

45
00:04:23,580 --> 00:04:26,940
X list, and then the coefficients will be a zero.

46
00:04:30,780 --> 00:04:35,190
And so then we have plotted here our polynomial.

47
00:04:35,430 --> 00:04:37,620
So we did not plot our data this time.

48
00:04:37,950 --> 00:04:39,660
We just plotted the polynomial.

49
00:04:40,380 --> 00:04:47,310
So ideally, we will start from just some random values of zero because we shouldn't know what these

50
00:04:47,310 --> 00:04:48,150
values are yet.

51
00:04:48,630 --> 00:04:54,030
And then we use our method that we will implement in the following lectures, and then we will update

52
00:04:54,030 --> 00:04:55,380
the values.

53
00:04:55,410 --> 00:05:00,330
At some point, we should hopefully end up with values that are quite similar to these.

54
00:05:00,750 --> 00:05:07,260
And then our function will look very similar to this one so that our data points are described very

55
00:05:07,260 --> 00:05:07,530
well.

56
00:05:08,760 --> 00:05:12,990
And for this, we will continue with the finding an error of function.

57
00:05:13,560 --> 00:05:19,890
So assuming that we do not have the correct values of a yet, then there will be some error.

58
00:05:20,160 --> 00:05:22,560
And first of all, we need a measure for this error.

