1
00:00:00,400 --> 00:00:02,770
So now let's start building the data.

2
00:00:02,800 --> 00:00:10,720
So the first thing is, well, we we start by this the easiest thing.

3
00:00:10,720 --> 00:00:14,080
So let's first define the initial condition.

4
00:00:14,080 --> 00:00:16,570
So def.

5
00:00:17,470 --> 00:00:18,880
Initial.

6
00:00:19,930 --> 00:00:21,460
Condition can.

7
00:00:23,740 --> 00:00:24,640
Edition.

8
00:00:25,370 --> 00:00:31,190
Well, take X and Y and it will return the initial condition.

9
00:00:31,190 --> 00:00:33,710
So torch dot sine.

10
00:00:33,740 --> 00:00:41,120
This is of course we can, um, I mean we can add here like if we want a little bit, uh.

11
00:00:42,310 --> 00:00:43,810
More customization.

12
00:00:43,810 --> 00:00:45,310
But let's take it simple.

13
00:00:45,310 --> 00:00:53,200
And when just we return the actual initial condition as we write the equation in here, not kind of

14
00:00:53,200 --> 00:00:53,800
customized.

15
00:00:53,800 --> 00:00:58,930
If you want to customize it, you need to actually go to here and change the return function.

16
00:00:58,930 --> 00:01:02,800
So dot sign torch.py.

17
00:01:02,830 --> 00:01:09,250
Of course we can use math.py as well, but let's just use torches as it will work.

18
00:01:09,250 --> 00:01:11,170
And then torch.

19
00:01:11,950 --> 00:01:12,970
Dot sign.

20
00:01:14,090 --> 00:01:17,660
And torch dot pi.

21
00:01:18,940 --> 00:01:19,930
Multiply.

22
00:01:20,360 --> 00:01:21,610
Multiply two.

23
00:01:21,650 --> 00:01:22,240
Y.

24
00:01:23,020 --> 00:01:32,200
So this is the initial condition and it will give us a like a kind of hump, a peak around the zero.

25
00:01:32,200 --> 00:01:38,110
And as the the time goes, this peak will collapse.

26
00:01:38,140 --> 00:01:39,460
It will diffuse.

27
00:01:40,300 --> 00:01:46,410
You can use other, of course, networks or other sorry like functions.

28
00:01:46,450 --> 00:01:49,120
Def boundary.

29
00:01:49,160 --> 00:01:50,290
Boundary.

30
00:01:52,180 --> 00:01:54,130
Same condition can.

31
00:01:55,180 --> 00:01:57,130
On duration.

32
00:01:57,820 --> 00:02:05,590
We will have X, we will have Y, and we will have T, and we have a custom value.

33
00:02:06,220 --> 00:02:07,150
Custom.

34
00:02:08,200 --> 00:02:12,880
Value and this will return.

35
00:02:13,930 --> 00:02:15,280
Torch dot.

36
00:02:16,240 --> 00:02:17,200
Full.

37
00:02:17,200 --> 00:02:22,570
Like basically we will have the same.

38
00:02:24,510 --> 00:02:28,320
X the same shape as x.

39
00:02:29,080 --> 00:02:32,350
And with we will give it the custom value.

40
00:02:32,530 --> 00:02:33,880
Custom.

41
00:02:35,390 --> 00:02:43,130
And this core value, of course, I mean, in this example, it's a bit kind of simple.

42
00:02:43,130 --> 00:02:51,710
So x y it will be A3A box like a three, not triangle or a square.

43
00:02:51,830 --> 00:02:54,050
We have X and Y is the same.

44
00:02:54,050 --> 00:02:59,330
And so this shape is the same for.

45
00:02:59,330 --> 00:03:06,290
So if we if we have different like if we have X and Y is different, you need to return a different

46
00:03:06,290 --> 00:03:06,730
way.

47
00:03:06,740 --> 00:03:10,850
Of course this is it depends on you as a coder.

48
00:03:10,850 --> 00:03:14,840
And here I'm just trying to keep things as simple as possible.

49
00:03:14,840 --> 00:03:25,040
This is a box or the problem we are trying to to, to make or to solve is as simple as or it is just

50
00:03:25,130 --> 00:03:30,200
a triangle, a square with x and Y.

51
00:03:30,200 --> 00:03:31,460
And then.

52
00:03:33,930 --> 00:03:38,430
With X and y and x will equal to Y.

53
00:03:38,430 --> 00:03:47,430
And then what we will have is we will have something like in the middle, a hump like this, that we

54
00:03:47,430 --> 00:03:59,040
will give it the the value of this will be computed or it will be generated by the sine wave, the sine

55
00:03:59,040 --> 00:03:59,610
wave.

56
00:03:59,610 --> 00:04:08,700
And then as the time goes and of course, this this direction, this direction is you or the temperature.

57
00:04:08,700 --> 00:04:13,740
And as the time goes, the heat will start to diffuse.

58
00:04:13,950 --> 00:04:14,850
So.

59
00:04:15,660 --> 00:04:17,880
So this is what we what we're doing.

60
00:04:17,880 --> 00:04:21,990
And so initial condition, boundary condition, shift, enter.

61
00:04:22,500 --> 00:04:25,560
Now, after that, what do we need to do?

62
00:04:26,910 --> 00:04:29,550
So far, we don't have really a domain.

63
00:04:29,550 --> 00:04:35,310
We don't we just have a function that you give it X and Y, give you back the initial condition and

64
00:04:35,310 --> 00:04:37,890
x and Y give you back the Or.

65
00:04:37,890 --> 00:04:40,590
Yeah, X and y and give you back the boundary condition.

66
00:04:40,650 --> 00:04:48,450
So now what we want to do is we want to a function that generate a training data.

67
00:04:49,020 --> 00:04:52,740
Training data.

68
00:04:52,740 --> 00:04:58,590
And actually this is more like, well, the correct thing is, of course it's all training data.

69
00:04:58,590 --> 00:05:04,320
But the correct analogy here is this function is going to generate a domain points.

70
00:05:04,500 --> 00:05:18,690
So generating the points we start by x equals torch dot random and we will have the number of points

71
00:05:18,840 --> 00:05:26,650
and so that we will have the rows, it will be number of points, say 1000 point whatever number of

72
00:05:26,650 --> 00:05:28,330
points we want for training.

73
00:05:28,330 --> 00:05:30,700
And the column is one.

74
00:05:30,850 --> 00:05:34,600
So for our case, we don't need more than one.

75
00:05:34,600 --> 00:05:40,780
And actually this way of generation it will generate points from 0 to 1.

76
00:05:40,930 --> 00:05:46,480
Here requires grad equals.

77
00:05:46,480 --> 00:05:47,320
True.

78
00:05:48,280 --> 00:05:49,150
And.

79
00:05:49,670 --> 00:05:51,860
We do the same thing for.

80
00:05:52,880 --> 00:05:53,770
Why.

81
00:05:53,780 --> 00:05:55,400
And same thing for tea.

82
00:05:55,730 --> 00:05:58,670
So why random?

83
00:05:59,000 --> 00:06:00,350
All of it is the same.

84
00:06:00,590 --> 00:06:03,440
And tea also the same.

85
00:06:04,900 --> 00:06:11,190
And returns the X, Y and T.

86
00:06:12,610 --> 00:06:14,350
And we shift enter.

87
00:06:14,680 --> 00:06:20,830
So now we have the first function is initial condition, the second function boundary condition.

88
00:06:20,920 --> 00:06:23,830
Third function is the function that generates a point.

89
00:06:24,250 --> 00:06:30,200
The fourth thing is we need to do is all these are just points in the middle.

90
00:06:30,220 --> 00:06:33,370
We need another generator or this.

91
00:06:33,370 --> 00:06:40,030
These points are just spread all the way around the network, but around the domain.

92
00:06:40,030 --> 00:06:42,910
But what we need is we need a function.

93
00:06:44,460 --> 00:06:48,150
That generates points Generate boundary points.

94
00:06:49,170 --> 00:06:50,100
Rate.

95
00:06:50,580 --> 00:06:52,080
Boundary.

96
00:06:54,530 --> 00:06:55,250
Points.

97
00:06:55,250 --> 00:06:59,300
And we will have also the same thing, number of points.

98
00:06:59,660 --> 00:07:03,230
And then what we will do is X.

99
00:07:05,450 --> 00:07:11,600
Boundary equals torch dot.

100
00:07:12,800 --> 00:07:13,580
Tensor.

101
00:07:14,900 --> 00:07:20,780
And we will generate from zero 0 to 1.0.

102
00:07:22,710 --> 00:07:24,360
Dot re.

103
00:07:25,560 --> 00:07:26,280
Pete.

104
00:07:26,490 --> 00:07:30,780
This thing of number.

105
00:07:32,590 --> 00:07:33,580
Number.

106
00:07:35,060 --> 00:07:36,290
A number of points.

107
00:07:40,320 --> 00:07:41,370
Over to.

108
00:07:42,800 --> 00:07:43,280
To.

109
00:07:45,330 --> 00:07:46,260
And.

110
00:07:47,510 --> 00:07:48,350
Why?

111
00:07:51,780 --> 00:07:52,870
Boundary.

112
00:07:54,030 --> 00:07:57,720
Will equals torch dot tensor.

113
00:07:58,770 --> 00:07:59,640
And.

114
00:08:00,800 --> 00:08:01,960
Uh, will.

115
00:08:02,060 --> 00:08:02,750
Random.

116
00:08:04,080 --> 00:08:04,830
Rent.

117
00:08:05,730 --> 00:08:10,500
And we will also have them as number of points.

118
00:08:14,410 --> 00:08:20,490
One thing to note is this operator like divide.

119
00:08:20,500 --> 00:08:28,480
Divide by two means we need to repeat this operation, the tensor like generating having this tensor

120
00:08:28,480 --> 00:08:31,060
from 0 to 1 two.

121
00:08:31,570 --> 00:08:37,300
Well, basically, let's say if we have ten times, we need to repeat it five times.

122
00:08:37,420 --> 00:08:45,460
If the number of points enter is a little bit odd, like let's say like 11, the 11 divide by two,

123
00:08:45,490 --> 00:08:51,580
it will be five point something and then then it will be basically five again.

124
00:08:51,700 --> 00:08:58,990
So why boundary equals tensor dot random.

125
00:08:58,990 --> 00:09:08,260
And now we just generate so we make first the first tensor, it will generate a point that is like kind

126
00:09:08,260 --> 00:09:20,120
of a spaced like in a mesh wise and this one, it will generate just random values from a like just

127
00:09:20,150 --> 00:09:28,250
number of points that it will be random for Y, but here it will be only zero and one.

128
00:09:28,250 --> 00:09:38,720
So the tensor will be at zero and at one and it will keep having a so the x axis has to be left or right

129
00:09:38,720 --> 00:09:42,080
and the y axis we just random whatever it is.

130
00:09:43,600 --> 00:09:46,720
This is the boundary, of course, in the x axis.

131
00:09:46,720 --> 00:09:50,860
But what we need to do is we need also to generate boundaries in the y axis.

132
00:09:50,860 --> 00:10:01,240
For that, we need to if we make another random thing if torch dot random.

133
00:10:02,220 --> 00:10:03,150
More than.

134
00:10:03,840 --> 00:10:09,360
Well, like, basically it will generate from 0 to 1 random value or 0.5.

135
00:10:10,660 --> 00:10:12,460
And X.

136
00:10:13,460 --> 00:10:16,490
We just switched them Expounder.

137
00:10:18,440 --> 00:10:19,610
Why boundary.

138
00:10:22,170 --> 00:10:23,100
Equals.

139
00:10:23,130 --> 00:10:27,240
We switch the thing, so x boundary will be y boundary.

140
00:10:27,870 --> 00:10:30,330
And why boundary.

141
00:10:30,360 --> 00:10:32,010
This one will be expanded.

142
00:10:34,480 --> 00:10:35,710
Why did we do that?

143
00:10:36,280 --> 00:10:46,000
What we did is we went to the domain and from 0 to 1 we made some points or we want to make these points.

144
00:10:46,000 --> 00:10:52,780
That is X is set a value of zero and or and one.

145
00:10:52,780 --> 00:10:58,420
So x is is zero and y is x is zero.

146
00:10:58,420 --> 00:11:01,780
And the first value and the second value is one.

147
00:11:01,840 --> 00:11:05,950
And what we did is we generate random values around it.

148
00:11:05,950 --> 00:11:11,470
So here we have X will be zero and x will be one.

149
00:11:11,860 --> 00:11:19,870
And what we did, the first thing is we went here and we made just any random value in this location,

150
00:11:19,870 --> 00:11:23,830
just any random values here and here.

151
00:11:24,870 --> 00:11:27,510
The same thing here in random values.

152
00:11:27,510 --> 00:11:33,840
And then what we did is we took part of these random values and we put them here.

153
00:11:35,710 --> 00:11:41,120
So now we have boundary values around this area.

154
00:11:41,140 --> 00:11:46,030
So the last thing we need to do is return.

155
00:11:50,140 --> 00:11:52,930
X x boundary.

156
00:11:54,150 --> 00:11:56,070
And we reshape it.

157
00:11:57,840 --> 00:11:59,640
Into minus one.

158
00:11:59,640 --> 00:12:00,240
One.

159
00:12:01,010 --> 00:12:04,220
So one only one point.

160
00:12:04,580 --> 00:12:06,710
So the dimension is the rows.

161
00:12:06,740 --> 00:12:10,790
And it is just to make sure it is only one row.

162
00:12:11,810 --> 00:12:13,850
Same thing for Y.

163
00:12:21,310 --> 00:12:22,480
For why?

164
00:12:25,230 --> 00:12:27,600
And we reshape it this way.

165
00:12:29,950 --> 00:12:36,190
No, this is generating the boundary points.

166
00:12:36,220 --> 00:12:44,020
Now what we need is to generate the training data, the boundary training data generate.

167
00:12:45,190 --> 00:12:46,390
Boundary.

168
00:12:48,200 --> 00:12:49,430
Raining.

169
00:12:51,000 --> 00:12:56,100
Data and we will add number number of points.

170
00:12:59,230 --> 00:13:00,370
And here.

171
00:13:01,190 --> 00:13:07,640
What we will do is, Well, we need the first generator.

172
00:13:08,910 --> 00:13:17,220
Which is generating the points, this function and we will pass on the number of points.

173
00:13:18,920 --> 00:13:23,090
And think I need a little bit space.

174
00:13:23,810 --> 00:13:25,280
And then the.

175
00:13:27,390 --> 00:13:32,160
Time will be torch dot again random.

176
00:13:32,160 --> 00:13:34,470
We don't really care.

177
00:13:34,770 --> 00:13:38,160
Number of points.

178
00:13:39,680 --> 00:13:45,320
And we will have the column one and requires.

179
00:13:46,880 --> 00:13:47,750
Great.

180
00:13:49,720 --> 00:13:50,140
And.

181
00:13:52,210 --> 00:13:53,980
That equals true.

182
00:13:56,020 --> 00:13:56,980
Return.

183
00:13:58,690 --> 00:13:59,380
Expunging.

184
00:14:00,810 --> 00:14:01,860
Why boundary.

185
00:14:03,610 --> 00:14:04,180
Empty.

186
00:14:07,340 --> 00:14:08,030
And shift enter.

187
00:14:09,660 --> 00:14:10,740
With that.

188
00:14:11,010 --> 00:14:13,650
We'll just make housekeeping a little bit.

189
00:14:15,610 --> 00:14:16,390
Just like this.

190
00:14:16,840 --> 00:14:18,760
So with that, what did we do?

191
00:14:18,790 --> 00:14:20,800
We actually generated.

192
00:14:22,260 --> 00:14:24,300
A boundary point.

193
00:14:24,300 --> 00:14:28,350
And with this function, what we did, we ordered a boundary point.

194
00:14:28,350 --> 00:14:33,600
And this function gave us this boundary point that is split somehow, randomly.

195
00:14:33,600 --> 00:14:39,200
And the other one is we just took some random from 0 to 1.

196
00:14:39,220 --> 00:14:43,860
The time just we took again some random points in time.

197
00:14:44,460 --> 00:14:49,260
Again, we're training the network is not really explicit solution.

198
00:14:50,900 --> 00:14:52,610
It's more like implicit solution.

199
00:14:52,610 --> 00:14:56,300
But but this time we don't really have a grid.

200
00:14:56,330 --> 00:14:57,320
We don't need a grid.

201
00:14:57,350 --> 00:15:04,280
We just randomly separate these points or generate these points to actually get the required data.
