1 00:00:00,000 --> 00:00:00,030 2 00:00:00,030 --> 00:00:02,330 The following content is provided under a Creative 3 00:00:02,330 --> 00:00:03,610 Commons license. 4 00:00:03,610 --> 00:00:05,770 Your support will help MIT OpenCourseWare 5 00:00:05,770 --> 00:00:09,960 continue to offer high quality educational research for free. 6 00:00:09,960 --> 00:00:12,590 To make a donation, or to view additional materials 7 00:00:12,590 --> 00:00:16,900 from hundreds of MIT courses, visit MIT OpenCourseWare 8 00:00:16,900 --> 00:00:19,290 at ocw.mit.edu. 9 00:00:19,290 --> 00:00:24,110 PROFESSOR STRANG: I'm open for questions 10 00:00:24,110 --> 00:00:27,560 as always on every aspect, or comments 11 00:00:27,560 --> 00:00:30,020 on every aspect of the course. 12 00:00:30,020 --> 00:00:33,030 Yeah? 13 00:00:33,030 --> 00:00:52,720 The MATLAB problem, yes. 14 00:00:52,720 --> 00:00:55,170 I better remember what that MATLAB problem is. 15 00:00:55,170 --> 00:01:04,130 So it's solving the equation -u''+Vu' equal some delta 16 00:01:04,130 --> 00:01:09,540 function halfway along? 17 00:01:09,540 --> 00:01:17,170 And I chose boundary conditions like those 18 00:01:17,170 --> 00:01:24,180 so that this gets replaced by a matrix K over delta x squared. 19 00:01:24,180 --> 00:01:30,020 And this term is V times some centered difference. 20 00:01:30,020 --> 00:01:33,780 I don't know whether I should use C. We called C, earlier 21 00:01:33,780 --> 00:01:36,010 in the book, C was a circulant. 22 00:01:36,010 --> 00:01:40,630 This is a centered first difference over delta x 23 00:01:40,630 --> 00:01:46,920 equal right-hand side. 24 00:01:46,920 --> 00:01:59,400 All that multiplies the discrete solution u. 25 00:01:59,400 --> 00:02:01,460 I didn't get that very well for the camera. 26 00:02:01,460 --> 00:02:03,820 Maybe I'll say it again. 27 00:02:03,820 --> 00:02:09,250 We have the second difference that corresponds to -u''. 28 00:02:09,250 --> 00:02:12,550 And V times the first difference that corresponds to Vu'. 29 00:02:12,550 --> 00:02:18,810 And then, the problem is-- 30 00:02:18,810 --> 00:02:23,670 So the physical problem is, what happens as V gets larger? 31 00:02:23,670 --> 00:02:25,510 V grows. 32 00:02:25,510 --> 00:02:31,510 How does the solution change as V increases? 33 00:02:31,510 --> 00:02:34,700 So it's a very practical problem. 34 00:02:34,700 --> 00:02:39,440 The V measures the importance of this convection, 35 00:02:39,440 --> 00:02:43,490 the velocity of the fluid. 36 00:02:43,490 --> 00:02:56,810 Then n, which is, well maybe delta x is 1/(n+1), maybe. 37 00:02:56,810 --> 00:03:02,340 So that we would have n interior points and we know 38 00:03:02,340 --> 00:03:06,620 the boundary values. 39 00:03:06,620 --> 00:03:14,080 So the question is how do we interpret this increasing n? 40 00:03:14,080 --> 00:03:17,500 I guess we expect more and more accuracy, right? 41 00:03:17,500 --> 00:03:21,380 As n increases, delta x getting smaller. 42 00:03:21,380 --> 00:03:27,430 Our idea is that this should be a better and better 43 00:03:27,430 --> 00:03:33,960 approximation to the differential equation. 44 00:03:33,960 --> 00:03:38,640 The question about the eigenvalues of this matrix, 45 00:03:38,640 --> 00:03:44,580 I don't know exactly the answer. 46 00:03:44,580 --> 00:03:49,020 So the eigenvalues, did you discover that the eigenvalues 47 00:03:49,020 --> 00:03:50,520 suddenly, they change? 48 00:03:50,520 --> 00:03:56,060 They're real for small values of V and n. 49 00:03:56,060 --> 00:04:02,290 But then there's some point at which they become complex. 50 00:04:02,290 --> 00:04:09,390 And a point that involves both V and delta x actually, V and n. 51 00:04:09,390 --> 00:04:12,680 It's kind of interesting. 52 00:04:12,680 --> 00:04:22,330 I guess at this moment, interesting is the key word. 53 00:04:22,330 --> 00:04:24,590 So what is the physics going on here? 54 00:04:24,590 --> 00:04:35,960 So I have a 1-D flow and it's blocked 55 00:04:35,960 --> 00:04:38,380 by these boundary conditions are sort 56 00:04:38,380 --> 00:04:42,120 of blocking it at both ends. 57 00:04:42,120 --> 00:04:43,920 And I'm looking for a steady state. 58 00:04:43,920 --> 00:04:47,800 And I'm feeding in this source here. 59 00:04:47,800 --> 00:04:54,040 So I'm feeding in a source halfway along. 60 00:04:54,040 --> 00:04:55,920 So I think that would be right. 61 00:04:55,920 --> 00:05:01,430 Now what's going to happen roughly? 62 00:05:01,430 --> 00:05:05,240 This term is, I think, flowing to the right. 63 00:05:05,240 --> 00:05:11,850 So it's going to carry, suppose this was smoke or particles 64 00:05:11,850 --> 00:05:13,280 or whatever. 65 00:05:13,280 --> 00:05:16,310 This is like an environmental differential 66 00:05:16,310 --> 00:05:19,310 equation or a chemical engineering equation. 67 00:05:19,310 --> 00:05:22,820 Just oh, and more and more applications. 68 00:05:22,820 --> 00:05:30,720 So I think of it as this term is carrying the flow with it. 69 00:05:30,720 --> 00:05:31,400 Like, that way. 70 00:05:31,400 --> 00:05:38,010 So I'm expecting your solutions to be larger on this side. 71 00:05:38,010 --> 00:05:43,200 And how do we get any action at all on the left? 72 00:05:43,200 --> 00:05:46,900 That comes from the diffusion. 73 00:05:46,900 --> 00:05:52,800 The particles, when they enter, get carried away, and faster 74 00:05:52,800 --> 00:05:54,750 and faster as V increases. 75 00:05:54,750 --> 00:05:57,660 But at the same time they diffuse, 76 00:05:57,660 --> 00:05:59,290 they bounce back and forth. 77 00:05:59,290 --> 00:06:04,540 And some bit of it goes this way. 78 00:06:04,540 --> 00:06:06,520 But not a lot. 79 00:06:06,520 --> 00:06:11,240 I'm guessing that the solution would have a profile that 80 00:06:11,240 --> 00:06:13,010 would be kind of small. 81 00:06:13,010 --> 00:06:16,140 And then there's whatever jump there has to be here, and then 82 00:06:16,140 --> 00:06:18,380 larger there. 83 00:06:18,380 --> 00:06:25,630 Oh, but then I have to get it to zero. 84 00:06:25,630 --> 00:06:27,330 It's a strange situation. 85 00:06:27,330 --> 00:06:31,340 And maybe I'll take this chance to mention it. 86 00:06:31,340 --> 00:06:38,790 What happens as V gets really, really large? 87 00:06:38,790 --> 00:06:43,540 You could say okay, as V gets extremely large, 88 00:06:43,540 --> 00:06:45,080 forget that term. 89 00:06:45,080 --> 00:06:47,070 This is the important term. 90 00:06:47,070 --> 00:06:49,510 Vu' equals that. 91 00:06:49,510 --> 00:06:52,030 Which we could easily solve. 92 00:06:52,030 --> 00:06:58,260 But this equation with just this term 93 00:06:58,260 --> 00:07:00,130 is only first order, right? 94 00:07:00,130 --> 00:07:01,950 It only has a first derivative. 95 00:07:01,950 --> 00:07:04,000 And how many boundary conditions would we 96 00:07:04,000 --> 00:07:08,080 expect to have if I gave you, if this wasn't here 97 00:07:08,080 --> 00:07:11,480 and I gave you just a first order equation? 98 00:07:11,480 --> 00:07:12,580 One. 99 00:07:12,580 --> 00:07:14,610 And we've got two. 100 00:07:14,610 --> 00:07:16,160 Which we're imposing. 101 00:07:16,160 --> 00:07:19,710 So this sort of limit as V increases, 102 00:07:19,710 --> 00:07:24,300 it produces something called a boundary layer. 103 00:07:24,300 --> 00:07:31,410 The solution is forced to satisfy these boundary 104 00:07:31,410 --> 00:07:31,960 conditions. 105 00:07:31,960 --> 00:07:34,210 One of them, it's quite happy about. 106 00:07:34,210 --> 00:07:36,720 The other one, it didn't really want to satisfy. 107 00:07:36,720 --> 00:07:41,280 It only satisfied them because, I had two 108 00:07:41,280 --> 00:07:42,950 originally with this part. 109 00:07:42,950 --> 00:07:47,330 But as this takes over, the struggle 110 00:07:47,330 --> 00:07:50,150 to satisfy that second boundary condition that it really 111 00:07:50,150 --> 00:07:52,940 doesn't want to satisfy is resolved 112 00:07:52,940 --> 00:07:56,080 by something, a layer that just makes 113 00:07:56,080 --> 00:08:00,870 a sort of exponential correction at the boundary to get 114 00:08:00,870 --> 00:08:03,030 to where it's supposed to go. 115 00:08:03,030 --> 00:08:03,860 So, anyway. 116 00:08:03,860 --> 00:08:08,850 This is a model problem that has boundary layers. 117 00:08:08,850 --> 00:08:13,940 Those are terrifically important in aerodynamics, 118 00:08:13,940 --> 00:08:17,790 you have layers around the actual aircraft. 119 00:08:17,790 --> 00:08:22,980 So lots of physics and computational science 120 00:08:22,980 --> 00:08:28,430 is hiding in this type of example. 121 00:08:28,430 --> 00:08:29,880 So those are a few words. 122 00:08:29,880 --> 00:08:34,790 But not an answer to your question. 123 00:08:34,790 --> 00:08:38,950 I guess I'm happy if you, for example, let 124 00:08:38,950 --> 00:08:43,450 me know where the eigenvalues change from real to complex. 125 00:08:43,450 --> 00:08:46,040 I mean, it happens, but you can probably, 126 00:08:46,040 --> 00:08:47,840 if you look at the matrix, you can 127 00:08:47,840 --> 00:08:58,720 see what happens at the point where that change takes place. 128 00:08:58,720 --> 00:08:59,720 That's some comments. 129 00:08:59,720 --> 00:09:05,140 And with the MATLAB, pure MATLAB part, I guess I'm hoping, 130 00:09:05,140 --> 00:09:09,430 and the graders are hoping, that by providing a code 131 00:09:09,430 --> 00:09:15,160 we'll get a pretty systematic set of answers 132 00:09:15,160 --> 00:09:23,390 for the requested V equal, what was it, 3 and 12 maybe, 133 00:09:23,390 --> 00:09:24,310 or something. 134 00:09:24,310 --> 00:09:26,330 And the requested n, delta x's. 135 00:09:26,330 --> 00:09:29,080 136 00:09:29,080 --> 00:09:31,510 So I'm hoping that everybody's graph 137 00:09:31,510 --> 00:09:36,620 is going to look pretty similar for those requests. 138 00:09:36,620 --> 00:09:42,190 And then if you could do a little exploration yourself 139 00:09:42,190 --> 00:09:47,430 and make that a fifth page, or really less 140 00:09:47,430 --> 00:09:53,080 than a page, about take V larger, take n larger, 141 00:09:53,080 --> 00:09:54,790 what happens? 142 00:09:54,790 --> 00:09:57,740 I'm very happy. 143 00:09:57,740 --> 00:09:59,720 Or any direction. 144 00:09:59,720 --> 00:10:03,480 I mean, just think of it as a mini-project 145 00:10:03,480 --> 00:10:08,060 to do the requested ones and then 146 00:10:08,060 --> 00:10:15,280 to do a little experimentation. 147 00:10:15,280 --> 00:10:22,010 I'll just be interested about anything you observe. 148 00:10:22,010 --> 00:10:28,480 So there's no right answer to that part. 149 00:10:28,480 --> 00:10:33,030 Is that any help with the MATLAB? 150 00:10:33,030 --> 00:10:37,820 Let me just say, since you showed up today, 151 00:10:37,820 --> 00:10:40,940 if you have trouble with the MATLAB 152 00:10:40,940 --> 00:10:46,330 and you need Peter's help at noon Friday 153 00:10:46,330 --> 00:10:50,740 it would be okay to turn in the MATLAB later on Friday. 154 00:10:50,740 --> 00:10:52,730 I shouldn't say that. 155 00:10:52,730 --> 00:10:55,580 But I just did. 156 00:10:55,580 --> 00:10:57,520 So there you are. 157 00:10:57,520 --> 00:11:00,490 Right. 158 00:11:00,490 --> 00:11:06,450 I mean, this course, as you've begun to see, 159 00:11:06,450 --> 00:11:10,280 I know that you have lots of demands on your time. 160 00:11:10,280 --> 00:11:13,610 And sometimes you have job interviews. 161 00:11:13,610 --> 00:11:14,910 All sorts of stuff. 162 00:11:14,910 --> 00:11:17,320 Conferences that you have to go to. 163 00:11:17,320 --> 00:11:19,210 We deal with that. 164 00:11:19,210 --> 00:11:25,260 So just give me the homeworks as soon as you can. 165 00:11:25,260 --> 00:11:29,990 If you're ready Friday at class time, that's perfect. 166 00:11:29,990 --> 00:11:38,120 If are stuck on MATLAB and you want 167 00:11:38,120 --> 00:11:41,740 to go to Peter's discussion, which follows the Friday 168 00:11:41,740 --> 00:11:45,120 class in here, that's fine too. 169 00:11:45,120 --> 00:11:48,190 So that's some thoughts about the MATLAB 170 00:11:48,190 --> 00:11:53,200 and it's partly open-ended. 171 00:11:53,200 --> 00:11:57,030 What about lots of other things in this course? 172 00:11:57,030 --> 00:11:59,210 Homework came in. 173 00:11:59,210 --> 00:12:00,200 How was the homework? 174 00:12:00,200 --> 00:12:02,540 Maybe I just take this chance to ask. 175 00:12:02,540 --> 00:12:05,020 Was it a reasonable length? 176 00:12:05,020 --> 00:12:07,270 The homework three, the pset? 177 00:12:07,270 --> 00:12:09,940 178 00:12:09,940 --> 00:12:15,070 Not too bad? 179 00:12:15,070 --> 00:12:21,000 I will be able to post solutions because several people are 180 00:12:21,000 --> 00:12:28,240 contributing typed solutions that could go 181 00:12:28,240 --> 00:12:36,360 on on the math.mit.edu/cse website. 182 00:12:36,360 --> 00:12:39,520 Or they could also go on our 18.085 183 00:12:39,520 --> 00:12:41,350 website for this semester. 184 00:12:41,350 --> 00:12:42,630 Good. 185 00:12:42,630 --> 00:12:44,490 Okay, help me out with some questions. 186 00:12:44,490 --> 00:12:58,150 Thanks. 187 00:12:58,150 --> 00:13:01,400 So the question is about element matrices. 188 00:13:01,400 --> 00:13:12,450 In lecture 8, I guess it was, where we were assembling this, 189 00:13:12,450 --> 00:13:16,970 I used the word that's used by finite element people, 190 00:13:16,970 --> 00:13:21,710 we were assembling K. And one way to do it 191 00:13:21,710 --> 00:13:26,120 was to multiply the three matrices. 192 00:13:26,120 --> 00:13:30,060 But that's not how it's actually done. 193 00:13:30,060 --> 00:13:35,860 It's actually assembled out of small matrices. 194 00:13:35,860 --> 00:13:39,910 Maybe small K would be the right-- 195 00:13:39,910 --> 00:13:43,700 So this would be a K_element. 196 00:13:43,700 --> 00:13:47,580 Out of smaller element matrices. 197 00:13:47,580 --> 00:13:51,360 So for example, what's the element matrix for, 198 00:13:51,360 --> 00:13:56,770 one for each spring in this particular problem of springs 199 00:13:56,770 --> 00:13:57,770 and masses. 200 00:13:57,770 --> 00:14:03,660 So let me draw some springs, some masses, some springs, 201 00:14:03,660 --> 00:14:06,470 another mass, more springs, fixed, 202 00:14:06,470 --> 00:14:10,460 not fixed, whatever, maybe fixed-free 203 00:14:10,460 --> 00:14:12,140 the way I've drawn it there. 204 00:14:12,140 --> 00:14:16,940 So here's a spring with spring constant c_2. 205 00:14:16,940 --> 00:14:22,240 And we could look at the contribution 206 00:14:22,240 --> 00:14:29,160 to the whole matrix coming from this piece of the problem. 207 00:14:29,160 --> 00:14:32,570 This was actually, the finite element method 208 00:14:32,570 --> 00:14:36,560 has a wonderful history of people, 209 00:14:36,560 --> 00:14:38,890 and it had different names way back, 210 00:14:38,890 --> 00:14:44,710 of people seeing the structure as broken in pieces 211 00:14:44,710 --> 00:14:47,520 and then connected together. 212 00:14:47,520 --> 00:14:50,970 And then what did a typical piece look like? 213 00:14:50,970 --> 00:14:56,180 So a typical piece there, well, you 214 00:14:56,180 --> 00:14:59,290 let me just write down what this matrix is going to be. 215 00:14:59,290 --> 00:15:03,750 The little element matrix is coming from spring two. 216 00:15:03,750 --> 00:15:06,790 So this would be, like element two will 217 00:15:06,790 --> 00:15:10,260 be, it'll have a c_2 outside. 218 00:15:10,260 --> 00:15:12,630 I'll put the c_2 outside. 219 00:15:12,630 --> 00:15:18,530 And then inside will be a little, this guy. 220 00:15:18,530 --> 00:15:23,710 And we can talk more about why it's that one. 221 00:15:23,710 --> 00:15:30,800 But just to have the element matrix there on the board. 222 00:15:30,800 --> 00:15:38,540 So my claim is that this is a small piece of the big K. 223 00:15:38,540 --> 00:15:45,280 So the big K matrix, what's the size of the big K, of K itself? 224 00:15:45,280 --> 00:15:48,080 Three by three in this case, yeah, three masses. 225 00:15:48,080 --> 00:15:50,780 So it'll be three by three. 226 00:15:50,780 --> 00:15:56,650 So I'm thinking that this spring which 227 00:15:56,650 --> 00:16:03,340 connects mass one to mass two, so it's only going to be like, 228 00:16:03,340 --> 00:16:07,930 a two by two piece, a little local piece, you could say, 229 00:16:07,930 --> 00:16:13,050 that that little K fits in this-- 230 00:16:13,050 --> 00:16:20,430 is assembled into the-- I better call it K_2, right? 231 00:16:20,430 --> 00:16:26,230 So it's a little K that sits up in this two by two block 232 00:16:26,230 --> 00:16:29,540 and doesn't contribute to the rest. 233 00:16:29,540 --> 00:16:32,170 Then let's just draw the rest of the picture. 234 00:16:32,170 --> 00:16:35,380 So this would produce an element matrix 235 00:16:35,380 --> 00:16:39,010 that looks just the same, that's the beauty of this. 236 00:16:39,010 --> 00:16:43,260 That all the elements, apart from change in the spring 237 00:16:43,260 --> 00:16:44,760 constant, look the same. 238 00:16:44,760 --> 00:16:49,170 So there'd be a little K_3. 239 00:16:49,170 --> 00:16:51,430 And where will it go? 240 00:16:51,430 --> 00:16:55,170 This is the whole core to the point. 241 00:16:55,170 --> 00:16:57,690 It'll go to the lower right. 242 00:16:57,690 --> 00:17:00,910 Down here? 243 00:17:00,910 --> 00:17:02,820 Overlapping, overlapping. 244 00:17:02,820 --> 00:17:09,350 Because this mass is attached to that spring and to that one. 245 00:17:09,350 --> 00:17:12,760 So these little element matrices, they overlap. 246 00:17:12,760 --> 00:17:18,610 And you just need, if you can imagine the code that's 247 00:17:18,610 --> 00:17:22,480 going to do this, you need a list of springs 248 00:17:22,480 --> 00:17:25,140 and a list of masses and a list of the connections 249 00:17:25,140 --> 00:17:26,150 between them. 250 00:17:26,150 --> 00:17:29,990 And it'll sit in here because it's two by two. 251 00:17:29,990 --> 00:17:32,500 So that's two by two, that's two by two 252 00:17:32,500 --> 00:17:38,980 and in this overlap entry will be a c_2 from the upper box. 253 00:17:38,980 --> 00:17:43,850 It'll be a c_2+c_3 as we discovered by direct 254 00:17:43,850 --> 00:17:45,310 multiplication. 255 00:17:45,310 --> 00:17:47,640 So that's that spring. 256 00:17:47,640 --> 00:17:51,280 Now what about this first spring? 257 00:17:51,280 --> 00:17:54,290 So there's a little K_1. 258 00:17:54,290 --> 00:17:57,970 Now K_1 should look the same as this. 259 00:17:57,970 --> 00:17:59,480 Except what? 260 00:17:59,480 --> 00:18:04,300 So it's going to be a difference with this spring because? 261 00:18:04,300 --> 00:18:09,330 Because of this fixed end. 262 00:18:09,330 --> 00:18:12,320 There's no mass zero. 263 00:18:12,320 --> 00:18:17,830 K_1 would normally sit up here, but actually it's 264 00:18:17,830 --> 00:18:21,190 only going to be one by one. 265 00:18:21,190 --> 00:18:30,210 So the K_1 little element matrix would look like c_1[1, -1; -1, 266 00:18:30,210 --> 00:18:31,010 1]. 267 00:18:31,010 --> 00:18:34,670 And then the boundary conditions knock those out. 268 00:18:34,670 --> 00:18:39,390 And an interesting point if you're writing big code 269 00:18:39,390 --> 00:18:40,870 you have to decide. 270 00:18:40,870 --> 00:18:46,240 Do I, as I create K_1, this little element matrix, 271 00:18:46,240 --> 00:18:49,550 do I pay attention to the boundary conditions? 272 00:18:49,550 --> 00:18:53,970 And then K_1 would just be that single number 273 00:18:53,970 --> 00:18:56,350 c_1 which would sit there. 274 00:18:56,350 --> 00:19:01,940 So up there will be c_1 from the K_1 matrix and c_2 275 00:19:01,940 --> 00:19:05,170 from the k_2 matrix. 276 00:19:05,170 --> 00:19:08,690 That's the entry there. 277 00:19:08,690 --> 00:19:12,190 And then, as I say, in coding finite elements, which 278 00:19:12,190 --> 00:19:17,080 you guys may do at some point, there's a question. 279 00:19:17,080 --> 00:19:18,020 What's sufficient? 280 00:19:18,020 --> 00:19:23,350 Shall I pay attention to the boundary 281 00:19:23,350 --> 00:19:25,810 in creating these element matrices 282 00:19:25,810 --> 00:19:27,690 or shall I do it later? 283 00:19:27,690 --> 00:19:31,900 And the rule seems to be, do it later. 284 00:19:31,900 --> 00:19:36,860 So what gets created in finite elements 285 00:19:36,860 --> 00:19:43,200 is a, in our language would be a, free-free matrix. 286 00:19:43,200 --> 00:19:55,440 It's a matrix where even this spring has a two by two piece. 287 00:19:55,440 --> 00:20:01,440 So what's the problem with the free-free matrix? 288 00:20:01,440 --> 00:20:05,400 The free-free matrices, those with no supports, 289 00:20:05,400 --> 00:20:08,300 those matrices will be singular. 290 00:20:08,300 --> 00:20:10,000 Right, singular. 291 00:20:10,000 --> 00:20:13,350 Because the vector of all ones, if you 292 00:20:13,350 --> 00:20:17,130 multiply the K, the free-free matrix 293 00:20:17,130 --> 00:20:20,140 times the vector of all ones, you get zero. 294 00:20:20,140 --> 00:20:23,520 The whole thing could shift. 295 00:20:23,520 --> 00:20:28,080 And will have other rigid motions in two dimensions. 296 00:20:28,080 --> 00:20:31,050 Let's just think ahead here. 297 00:20:31,050 --> 00:20:36,550 What are the rigid motions, the null space of K, 298 00:20:36,550 --> 00:20:41,030 you could say, for a two-dimensional truss. 299 00:20:41,030 --> 00:20:44,320 So I've got a bunch of bars and springs. 300 00:20:44,320 --> 00:20:46,160 Think of a mattress. 301 00:20:46,160 --> 00:20:47,775 I'm in two dimensions, a mattress 302 00:20:47,775 --> 00:20:54,470 is a bunch of springs connected in a 2-D grid. 303 00:20:54,470 --> 00:20:58,810 And say it's free at both ends. 304 00:20:58,810 --> 00:21:00,850 So what can I do to a mattress? 305 00:21:00,850 --> 00:21:01,580 Oh, my gosh! 306 00:21:01,580 --> 00:21:05,680 I didn't expect that to be on videotape. 307 00:21:05,680 --> 00:21:06,870 So it's in the plane. 308 00:21:06,870 --> 00:21:09,380 We're in 2-D here. 309 00:21:09,380 --> 00:21:13,630 What can I do if there are no boundary conditions? 310 00:21:13,630 --> 00:21:15,740 Well I can shift it to the right. 311 00:21:15,740 --> 00:21:16,240 Right? 312 00:21:16,240 --> 00:21:18,040 That's our [1, 1, 1, 1, 1]. 313 00:21:18,040 --> 00:21:20,360 What else can I do? 314 00:21:20,360 --> 00:21:21,760 I can rotate. 315 00:21:21,760 --> 00:21:23,340 And I can shift it the other way. 316 00:21:23,340 --> 00:21:29,140 So there would be three rigid motions for the 2-D problem. 317 00:21:29,140 --> 00:21:33,420 Two translations and a rotation. 318 00:21:33,420 --> 00:21:35,460 And when you get up to three dimensions, 319 00:21:35,460 --> 00:21:40,250 do you want to guess what's the number in 3-D? 320 00:21:40,250 --> 00:21:41,110 Six. 321 00:21:41,110 --> 00:21:42,240 Number is six. 322 00:21:42,240 --> 00:21:46,580 Three translations and rotations around three axes. 323 00:21:46,580 --> 00:21:54,010 So those, either one rigid motion or three rigid motions 324 00:21:54,010 --> 00:21:58,410 or six rigid motions have to get, 325 00:21:58,410 --> 00:21:59,970 the boundary conditions eventually 326 00:21:59,970 --> 00:22:05,020 have to remove those, have to knock out rows and columns 327 00:22:05,020 --> 00:22:05,780 and remove them. 328 00:22:05,780 --> 00:22:13,150 But my point was just that quite efficient to do it later. 329 00:22:13,150 --> 00:22:15,820 The picture is so clear here. 330 00:22:15,820 --> 00:22:18,026 So the actual matrix would be four 331 00:22:18,026 --> 00:22:20,900 by four, the unreduced matrix. 332 00:22:20,900 --> 00:22:27,500 And then when we fix node zero there, 333 00:22:27,500 --> 00:22:30,560 that would knock out that part and leave the three by three 334 00:22:30,560 --> 00:22:31,630 that we want. 335 00:22:31,630 --> 00:22:38,250 So this is just discussion of how to think of this matrix K. 336 00:22:38,250 --> 00:22:42,220 So the direct way to think of it was 337 00:22:42,220 --> 00:22:46,840 as a product of big matrices. 338 00:22:46,840 --> 00:22:53,000 But in reality it's assembled from these element pieces. 339 00:22:53,000 --> 00:22:56,870 And of course, our goal in talking about finite elements 340 00:22:56,870 --> 00:23:00,430 will be to see that. 341 00:23:00,430 --> 00:23:04,620 It'll come up again, of course. 342 00:23:04,620 --> 00:23:11,150 Your good question led me there, but did I answer the question? 343 00:23:11,150 --> 00:23:14,970 And maybe the way I mentioned it in class was 344 00:23:14,970 --> 00:23:19,890 to notice that these guys, these element matrices 345 00:23:19,890 --> 00:23:22,770 can be thought of this way. 346 00:23:22,770 --> 00:23:26,450 It is matrix multiplication, but done differently. 347 00:23:26,450 --> 00:23:30,820 It's a column of this matrix times the number 348 00:23:30,820 --> 00:23:33,650 c here times a row of this. 349 00:23:33,650 --> 00:23:38,260 So it's matrix multiplication, columns times rows. 350 00:23:38,260 --> 00:23:49,060 So you can multiply AB, columns of A times rows of B 351 00:23:49,060 --> 00:23:55,090 and then add over, from one to n. 352 00:23:55,090 --> 00:24:01,340 So column of A times row of B. So a column, 353 00:24:01,340 --> 00:24:03,350 then, is a vector like this. 354 00:24:03,350 --> 00:24:10,590 A row is a vector like that. 355 00:24:10,590 --> 00:24:15,700 And the result is a full size matrix, 356 00:24:15,700 --> 00:24:18,880 but if the column is concentrated 357 00:24:18,880 --> 00:24:21,690 at a couple of nodes and the row is, 358 00:24:21,690 --> 00:24:28,630 then it will have zeroes everywhere except at that. 359 00:24:28,630 --> 00:24:34,230 This is the element matrix, with the C included. 360 00:24:34,230 --> 00:24:41,010 That would be the element matrix already blown up to full size 361 00:24:41,010 --> 00:24:43,590 by adding zeroes elsewhere. 362 00:24:43,590 --> 00:24:49,040 So, I mean the heart of the element matrix 363 00:24:49,040 --> 00:24:51,490 is where the action is on that spring. 364 00:24:51,490 --> 00:24:55,020 And then, when we assemble it, of course, 365 00:24:55,020 --> 00:24:59,090 it doesn't contribute down there. 366 00:24:59,090 --> 00:25:03,850 So the technology of finite elements is quite interesting 367 00:25:03,850 --> 00:25:05,160 and it fits. 368 00:25:05,160 --> 00:25:11,360 It's a beautiful way to see the discrete problem. 369 00:25:11,360 --> 00:25:15,770 Ready for another question of any sort. 370 00:25:15,770 --> 00:25:22,930 Thank you, good. 371 00:25:22,930 --> 00:25:25,090 Yeah, sorry, it got onto the problem set. 372 00:25:25,090 --> 00:25:29,430 And then I thought-- let me write those words 373 00:25:29,430 --> 00:25:34,500 down first, singular value decomposition. 374 00:25:34,500 --> 00:25:40,230 Well I won't write all those words. 375 00:25:40,230 --> 00:25:42,620 That's a wonderful thing. 376 00:25:42,620 --> 00:25:45,410 It's a highlight of matrix theory except 377 00:25:45,410 --> 00:25:47,150 for the length of its name. 378 00:25:47,150 --> 00:25:53,360 So SVD is what everybody calls it. 379 00:25:53,360 --> 00:25:57,250 It's only like, every year now people appreciate 380 00:25:57,250 --> 00:26:00,140 more and more the importance of this SVD, 381 00:26:00,140 --> 00:26:02,910 this singular value decomposition. 382 00:26:02,910 --> 00:26:09,030 So shall I say a few words about it now? 383 00:26:09,030 --> 00:26:14,500 Just a few. 384 00:26:14,500 --> 00:26:18,690 So it's Section 1.7 of the book. 385 00:26:18,690 --> 00:26:26,710 And my thought was, hey we've done so much matrix theory 386 00:26:26,710 --> 00:26:29,790 including eigenvalues and positive definiteness, 387 00:26:29,790 --> 00:26:32,700 let's get on and use it. 388 00:26:32,700 --> 00:26:36,260 And then I can come back to the SVD 389 00:26:36,260 --> 00:26:40,190 in a sort of lighter moment. 390 00:26:40,190 --> 00:26:42,100 Because I'm not thinking you will 391 00:26:42,100 --> 00:26:44,600 be responsible for the SVD. 392 00:26:44,600 --> 00:26:46,680 Eigenvalues I hope you're understanding. 393 00:26:46,680 --> 00:26:49,950 Positive definite I hope you're understanding. 394 00:26:49,950 --> 00:26:52,990 That's heart of the course stuff. 395 00:26:52,990 --> 00:26:58,360 But SVD is a key idea in linear algebra, 396 00:26:58,360 --> 00:27:01,050 but we can't do everything. 397 00:27:01,050 --> 00:27:06,770 But we can say what it is. 398 00:27:06,770 --> 00:27:08,990 What's the first point? 399 00:27:08,990 --> 00:27:11,200 The first point is that every matrix, 400 00:27:11,200 --> 00:27:14,910 even a rectangular matrix, has got a singular value 401 00:27:14,910 --> 00:27:15,770 decomposition. 402 00:27:15,770 --> 00:27:23,200 So the matrix A can be m by n. 403 00:27:23,200 --> 00:27:26,260 I wouldn't speak about the eigenvalues 404 00:27:26,260 --> 00:27:29,200 of a rectangular matrix. 405 00:27:29,200 --> 00:27:31,610 Because if I multiply, you remember, 406 00:27:31,610 --> 00:27:34,230 the eigenvalue equation wouldn't make sense. 407 00:27:34,230 --> 00:27:39,920 Ax=lambda*x is no good if A is rectangular. 408 00:27:39,920 --> 00:27:40,730 Right? 409 00:27:40,730 --> 00:27:44,720 The input would be of length n and the output 410 00:27:44,720 --> 00:27:50,250 would be of length m and this wouldn't work. 411 00:27:50,250 --> 00:27:54,820 So eigenvectors are not what I'm after. 412 00:27:54,820 --> 00:27:58,660 But somehow the goal of eigenvectors 413 00:27:58,660 --> 00:28:00,180 was to diagonalize. 414 00:28:00,180 --> 00:28:04,670 The goal of eigenvectors was to find these special directions 415 00:28:04,670 --> 00:28:09,440 in which the matrix A just acted like a number. 416 00:28:09,440 --> 00:28:16,330 And then, as we saw today in the part that partly still up here, 417 00:28:16,330 --> 00:28:19,050 we could solve equations by eigenvectors 418 00:28:19,050 --> 00:28:26,890 by looking for these, following these special guys. 419 00:28:26,890 --> 00:28:29,720 What do we do for a rectangular matrix? 420 00:28:29,720 --> 00:28:31,130 What replaces this? 421 00:28:31,130 --> 00:28:36,380 So this is now not good. 422 00:28:36,380 --> 00:28:40,960 The idea is simply we need two sets of vectors. 423 00:28:40,960 --> 00:28:48,910 We need some v's and some u's. 424 00:28:48,910 --> 00:28:52,860 So that's the central equation of the SVD. 425 00:28:52,860 --> 00:28:56,900 Now what can we get? 426 00:28:56,900 --> 00:29:01,130 So now we have more freedom because we're getting a bunch 427 00:29:01,130 --> 00:29:05,640 of v's that have, these guys are in R^n. 428 00:29:05,640 --> 00:29:07,070 They have length n, right? 429 00:29:07,070 --> 00:29:10,840 To multiply A times v, and the output 430 00:29:10,840 --> 00:29:17,620 is-- so there're n of these, n v's, 431 00:29:17,620 --> 00:29:19,900 we're in n-dimensional space. 432 00:29:19,900 --> 00:29:22,449 So those are called singular vectors. 433 00:29:22,449 --> 00:29:24,990 They're called right singular vectors because they're sitting 434 00:29:24,990 --> 00:29:28,050 to the right of A. And these guys, 435 00:29:28,050 --> 00:29:35,360 these outputs will be in-- these are v's in R^n, n dimensions. 436 00:29:35,360 --> 00:29:41,890 I have m of these, m u's in m-dimensional space. 437 00:29:41,890 --> 00:29:45,020 And these things are numbers, of course. 438 00:29:45,020 --> 00:29:50,190 And actually, they're all greater or equal to zero. 439 00:29:50,190 --> 00:29:53,650 So we can get, by allowing ourselves 440 00:29:53,650 --> 00:29:59,640 the freedom of two, right singular 441 00:29:59,640 --> 00:30:02,960 vectors and left singular vectors, we can get a lot more, 442 00:30:02,960 --> 00:30:06,870 and we can get, here's the punch line. 443 00:30:06,870 --> 00:30:13,040 We can get the v's to be orthogonal, orthonormal. 444 00:30:13,040 --> 00:30:19,030 Just like the eigenvectors of a symmetric matrix, 445 00:30:19,030 --> 00:30:21,800 we can get these v's, these singular 446 00:30:21,800 --> 00:30:24,640 vectors to be perpendicular to each other 447 00:30:24,640 --> 00:30:28,810 and we can get the u's to be perpendicular to each other. 448 00:30:28,810 --> 00:30:34,200 What we can't, what we're not shooting for is the v's to be 449 00:30:34,200 --> 00:30:36,340 the same as the u's. 450 00:30:36,340 --> 00:30:38,340 They're not even in the same space 451 00:30:38,340 --> 00:30:41,700 now, if the matrix A is rectangular. 452 00:30:41,700 --> 00:30:46,920 And even if the matrix A is square but not symmetric, 453 00:30:46,920 --> 00:30:49,580 we wouldn't get this perpendicularity. 454 00:30:49,580 --> 00:30:57,580 But we get it in the SVD by having different v's and u's. 455 00:30:57,580 --> 00:31:02,550 Here's my picture of linear algebra. 456 00:31:02,550 --> 00:31:10,470 This is the big picture of linear algebra. 457 00:31:10,470 --> 00:31:12,650 This over here is n-dimensional space. 458 00:31:12,650 --> 00:31:17,600 We have v's. 459 00:31:17,600 --> 00:31:19,920 Think of that as n-dimensional space. 460 00:31:19,920 --> 00:31:21,910 That's kind of a puny picture. 461 00:31:21,910 --> 00:31:29,510 But when I multiply by A, I take a vector here, 462 00:31:29,510 --> 00:31:33,490 I multiply by A. So let me just do that. 463 00:31:33,490 --> 00:31:38,140 I multiply by A, I take a vector v, well, I already put v, 464 00:31:38,140 --> 00:31:43,200 I take Av and I get something over here. 465 00:31:43,200 --> 00:31:51,330 And this will be the space of u's. 466 00:31:51,330 --> 00:31:53,730 Now I have to ask you one thing about linear algebra 467 00:31:53,730 --> 00:31:56,560 that I keep hammering away. 468 00:31:56,560 --> 00:32:04,310 If I take any vector and multiply by A, What do I get? 469 00:32:04,310 --> 00:32:11,570 If I take any vector v, like [1, 2]. 470 00:32:11,570 --> 00:32:16,850 Here's A, say [3, 6; 4, 7; 5, 8]. 471 00:32:16,850 --> 00:32:20,520 So that's A times v. What can you 472 00:32:20,520 --> 00:32:24,550 tell me about A times v that goes a little deeper than just 473 00:32:24,550 --> 00:32:26,890 telling me the numbers? 474 00:32:26,890 --> 00:32:33,930 It's a linear combination of the columns. 475 00:32:33,930 --> 00:32:36,880 These are the outputs, the Av's. 476 00:32:36,880 --> 00:32:40,030 So this space is called the column space. 477 00:32:40,030 --> 00:32:43,020 It's all combinations of the columns. 478 00:32:43,020 --> 00:32:50,530 These are all combinations of the columns. 479 00:32:50,530 --> 00:32:52,130 That's the column space. 480 00:32:52,130 --> 00:32:56,010 It's a bunch of vectors. 481 00:32:56,010 --> 00:33:04,720 So the point is that these u's, that I have like, a fantastic 482 00:33:04,720 --> 00:33:06,990 choice of axes. 483 00:33:06,990 --> 00:33:10,760 A linear algebra person would use the word, bases. 484 00:33:10,760 --> 00:33:13,640 But geometrically I'm saying they're 485 00:33:13,640 --> 00:33:17,310 fantastic axes in these spaces. 486 00:33:17,310 --> 00:33:23,290 So that if I choose the right axes in the two spaces, 487 00:33:23,290 --> 00:33:28,900 then one axis will go to that one when I multiply by A. 488 00:33:28,900 --> 00:33:30,440 The next one will go to that one. 489 00:33:30,440 --> 00:33:32,370 The third will go to that one. 490 00:33:32,370 --> 00:33:37,920 It just could not be better. 491 00:33:37,920 --> 00:33:43,530 And that's the statement. 492 00:33:43,530 --> 00:33:46,610 Now maybe I'll just say a word about where it's used 493 00:33:46,610 --> 00:33:51,600 or why it's useful. 494 00:33:51,600 --> 00:33:58,310 Oh, in so many applications. 495 00:33:58,310 --> 00:34:02,970 Well most of you are not biologists. 496 00:34:02,970 --> 00:34:04,680 And I'm not certainly. 497 00:34:04,680 --> 00:34:09,750 But we know that there's a lot of interesting math these days 498 00:34:09,750 --> 00:34:15,870 in a lot of interesting experiments with genes. 499 00:34:15,870 --> 00:34:20,680 So what happens? 500 00:34:20,680 --> 00:34:24,210 So we've got about 40 people here. 501 00:34:24,210 --> 00:34:34,960 And we measure the, well, we get data. 502 00:34:34,960 --> 00:34:36,990 That's what I'm really going to say. 503 00:34:36,990 --> 00:34:40,200 Somehow we got a giant amount of data. right?. 504 00:34:40,200 --> 00:34:41,520 Probably 40 columns. 505 00:34:41,520 --> 00:34:46,490 Everybody here is entitled to be a column of the matrix. 506 00:34:46,490 --> 00:34:51,600 And the entries will be like, have you got TB, 507 00:34:51,600 --> 00:34:55,110 what height, all this stuff. 508 00:34:55,110 --> 00:34:57,970 So you got enormous amount of data. 509 00:34:57,970 --> 00:35:02,180 And the question is, what's important in that data. 510 00:35:02,180 --> 00:35:05,850 You've got a million entries in a giant matrix 511 00:35:05,850 --> 00:35:08,590 and you want to extract the important thing. 512 00:35:08,590 --> 00:35:11,410 Well, it's the SVD that does it. 513 00:35:11,410 --> 00:35:14,230 You take that giant matrix of data, 514 00:35:14,230 --> 00:35:19,080 you find the v's and the sigmas and the u's. 515 00:35:19,080 --> 00:35:28,720 And then the largest sigmas are the most important information, 516 00:35:28,720 --> 00:35:31,580 if things are scaled, and statistics 517 00:35:31,580 --> 00:35:34,450 is coming into this also. 518 00:35:34,450 --> 00:35:43,200 I could a give sensible, much more mathematical discussion 519 00:35:43,200 --> 00:35:47,890 of-- One word, one name it goes under 520 00:35:47,890 --> 00:35:52,120 is principal component analysis. 521 00:35:52,120 --> 00:35:56,220 That's a standard tool for statisticians looking 522 00:35:56,220 --> 00:35:58,140 at giant amounts of data. 523 00:35:58,140 --> 00:36:01,080 Is to find the principal components 524 00:36:01,080 --> 00:36:04,960 and those will come from these eigenvectors. 525 00:36:04,960 --> 00:36:12,080 Well your question about the SVD set off that discussion. 526 00:36:12,080 --> 00:36:15,460 I'll only add a couple of words. 527 00:36:15,460 --> 00:36:22,870 These v's and these u's are actually eigenvectors. 528 00:36:22,870 --> 00:36:28,140 But they're not eigenvectors of A. v's happen 529 00:36:28,140 --> 00:36:31,730 to be the eigenvectors of A transpose A. 530 00:36:31,730 --> 00:36:35,650 And the u's happen to be eigenvectors of A, A transpose. 531 00:36:35,650 --> 00:36:40,860 And the linear algebra comes together 532 00:36:40,860 --> 00:36:45,200 to give you this key equation. 533 00:36:45,200 --> 00:36:47,880 And of course, you and I know that if I'm 534 00:36:47,880 --> 00:36:52,870 looking at the eigenvectors v of A transpose A, 535 00:36:52,870 --> 00:36:56,900 A transpose A is a symmetric matrix. 536 00:36:56,900 --> 00:36:58,480 In fact, positive definite. 537 00:36:58,480 --> 00:37:01,800 So that the eigenvectors will be orthogonal, 538 00:37:01,800 --> 00:37:03,740 the eigenvalues will be positive. 539 00:37:03,740 --> 00:37:07,580 And then this one is coming from the eigenvectors of A A 540 00:37:07,580 --> 00:37:12,360 transpose, which is different. 541 00:37:12,360 --> 00:37:15,460 So if the matrix A happened to be square, 542 00:37:15,460 --> 00:37:18,260 happened to be symmetric, happened to be positive 543 00:37:18,260 --> 00:37:21,450 definite, this would just be Ax=lambda*x. 544 00:37:21,450 --> 00:37:24,300 I didn't have to cross it out. 545 00:37:24,300 --> 00:37:26,710 I'll use K for that. 546 00:37:26,710 --> 00:37:30,840 So if the matrix A was one of our favorite matrices, 547 00:37:30,840 --> 00:37:34,860 was a K, that would be the case in which the SVD is 548 00:37:34,860 --> 00:37:37,820 no different from eigenvalues. 549 00:37:37,820 --> 00:37:40,840 The v's are the same as the u's, the sigmas 550 00:37:40,840 --> 00:37:46,460 are the same as the lambdas, all fine. 551 00:37:46,460 --> 00:37:49,180 This is sort of the way to get the beauty 552 00:37:49,180 --> 00:37:54,200 of positive definite symmetric matrices when the matrix itself 553 00:37:54,200 --> 00:37:56,560 that you start with isn't even square. 554 00:37:56,560 --> 00:38:00,890 Like this one. 555 00:38:00,890 --> 00:38:02,620 More than I wanted to say, more than you 556 00:38:02,620 --> 00:38:04,220 wanted to hear about the SVD. 557 00:38:04,220 --> 00:38:06,950 558 00:38:06,950 --> 00:38:08,130 What else? 559 00:38:08,130 --> 00:38:17,030 Yes, thank you. 560 00:38:17,030 --> 00:38:19,140 More about, sure. 561 00:38:19,140 --> 00:38:20,330 Let me repeat the question. 562 00:38:20,330 --> 00:38:23,330 So this refers to this morning's lecture, 563 00:38:23,330 --> 00:38:32,580 lecture 9 about time-dependent problems. 564 00:38:32,580 --> 00:38:35,080 And the point was that when I have a differential 565 00:38:35,080 --> 00:38:38,860 equation in time there're lots of ways to replace it 566 00:38:38,860 --> 00:38:45,560 by difference equations. 567 00:38:45,560 --> 00:38:49,820 So let's take the equation du/dt, 568 00:38:49,820 --> 00:38:55,860 let's make it first order, is some function of u, often, 569 00:38:55,860 --> 00:38:57,150 and t. 570 00:38:57,150 --> 00:39:02,420 That would be a first order. 571 00:39:02,420 --> 00:39:07,340 Yeah, it's going to look at when I write that much down. 572 00:39:07,340 --> 00:39:09,700 What have I got? 573 00:39:09,700 --> 00:39:14,560 I've got a first order differential equation. 574 00:39:14,560 --> 00:39:17,220 Is it linear? 575 00:39:17,220 --> 00:39:18,120 No. 576 00:39:18,120 --> 00:39:23,150 I'm allowing some, this function of u could be sin(u). 577 00:39:23,150 --> 00:39:25,190 It could be u to the tenth power. 578 00:39:25,190 --> 00:39:28,460 It could be e to the u. 579 00:39:28,460 --> 00:39:32,060 So this is how equations really come. 580 00:39:32,060 --> 00:39:35,530 The linear ones are the model problems that we can solve. 581 00:39:35,530 --> 00:39:40,610 This is how linear equations really come. 582 00:39:40,610 --> 00:39:43,320 Euler thought of, let's give Euler credit 583 00:39:43,320 --> 00:39:51,630 here, so forward Euler and backward Euler. 584 00:39:51,630 --> 00:39:58,900 And the point will be that this guy is explicit. 585 00:39:58,900 --> 00:40:01,420 So can I write that word so I don't forget to write it? 586 00:40:01,420 --> 00:40:02,870 Explicit. 587 00:40:02,870 --> 00:40:04,980 And that this guy will be implicit. 588 00:40:04,980 --> 00:40:10,190 And this is a big distinction. 589 00:40:10,190 --> 00:40:12,340 And we'll see it. 590 00:40:12,340 --> 00:40:20,290 So this says u_(n+1)-u_n over delta t is the value 591 00:40:20,290 --> 00:40:33,090 of the slope at the start of the step. 592 00:40:33,090 --> 00:40:36,450 So that's the most important, most basic, 593 00:40:36,450 --> 00:40:38,540 first thing you would think of. 594 00:40:38,540 --> 00:40:40,550 It replaces this by this. 595 00:40:40,550 --> 00:40:45,690 You start with u_0, and from this you get u_1. 596 00:40:45,690 --> 00:40:49,250 And then you know u_1 and from this you get u_2. 597 00:40:49,250 --> 00:40:55,790 And the point is at every step this equation is telling you 598 00:40:55,790 --> 00:40:58,130 what u_1 is from u_0. 599 00:40:58,130 --> 00:41:00,860 You just move u_0 over to that side. 600 00:41:00,860 --> 00:41:04,920 You've only got stuff you know and then you know u_1. 601 00:41:04,920 --> 00:41:07,740 Contrast that with backward Euler. 602 00:41:07,740 --> 00:41:15,055 So that's u_(n+1)-u_n over delta t is f at-- Now what am I going 603 00:41:15,055 --> 00:41:18,190 to put there? 604 00:41:18,190 --> 00:41:24,920 I'm going to put the end, the point we don't know yet. 605 00:41:24,920 --> 00:41:32,040 So it's the slope at u_(n+1) and the time that goes with it, 606 00:41:32,040 --> 00:41:34,250 t_(n+1). 607 00:41:34,250 --> 00:41:40,140 t_n is just a shorthand for n*delta t. 608 00:41:40,140 --> 00:41:43,460 n steps forward in time got us to t_n. 609 00:41:43,460 --> 00:41:45,650 This is one more step. 610 00:41:45,650 --> 00:41:52,560 Now why is this called implicit? 611 00:41:52,560 --> 00:41:57,470 How do I find u_(n+1) out of this? 612 00:41:57,470 --> 00:41:59,480 I've got to solve for it. 613 00:41:59,480 --> 00:42:01,740 It's much more expensive. 614 00:42:01,740 --> 00:42:04,390 Because it'll be probably a non-linear system of 615 00:42:04,390 --> 00:42:07,280 equations to solve. 616 00:42:07,280 --> 00:42:09,520 We'll take a little time on that. 617 00:42:09,520 --> 00:42:12,110 But of course, there's one outstanding method 618 00:42:12,110 --> 00:42:16,020 to solve a system of non-linear equations 619 00:42:16,020 --> 00:42:18,190 and that's called Newton's method. 620 00:42:18,190 --> 00:42:20,120 So Newton is coming in. 621 00:42:20,120 --> 00:42:26,440 Newton's method is sort of the first, the good way, 622 00:42:26,440 --> 00:42:31,600 if you can do it, to solve. 623 00:42:31,600 --> 00:42:37,020 Well when I say solve, I mean set up an iteration which, 624 00:42:37,020 --> 00:42:43,660 after maybe three loops or five loops will be accurate 625 00:42:43,660 --> 00:42:47,870 to enough digits that you can say, okay, that's u_(n+1). 626 00:42:47,870 --> 00:42:49,970 On to the next step. 627 00:42:49,970 --> 00:42:53,100 Then the next step will have the same equation 628 00:42:53,100 --> 00:42:57,220 but with n up one. 629 00:42:57,220 --> 00:43:00,190 So it'd be u_(n+2)-u_(n+1). 630 00:43:00,190 --> 00:43:05,220 So you see the extra work here, but it's more stable. 631 00:43:05,220 --> 00:43:08,000 The way this one spiraled out, this one 632 00:43:08,000 --> 00:43:12,620 spiraled in in the model problem. 633 00:43:12,620 --> 00:43:16,650 I hope you look at that Section 2.2 which 634 00:43:16,650 --> 00:43:21,380 was about the model problem that we discussed today. 635 00:43:21,380 --> 00:43:22,950 There's more to say. 636 00:43:22,950 --> 00:43:29,710 I mean, this is the central problem of time-dependent, 637 00:43:29,710 --> 00:43:34,430 evolving initial value problems. 638 00:43:34,430 --> 00:43:37,330 You're sort of marching forward. 639 00:43:37,330 --> 00:43:41,830 But here, each step of the march takes an inner loop 640 00:43:41,830 --> 00:43:49,600 which has to work hard to solve, to find, where you march to. 641 00:43:49,600 --> 00:43:52,210 Is that a help, to indicate what? 642 00:43:52,210 --> 00:43:59,040 Because this is a very fundamental difference. 643 00:43:59,040 --> 00:44:05,250 And Chapter 6 of the book develops higher order methods. 644 00:44:05,250 --> 00:44:08,540 These are both first order, first order accurate. 645 00:44:08,540 --> 00:44:14,430 The error that you're making is of the order of delta t. 646 00:44:14,430 --> 00:44:16,220 That's not great, right? 647 00:44:16,220 --> 00:44:18,270 Because you would have to take many, 648 00:44:18,270 --> 00:44:24,810 many small steps to have a reasonable error. 649 00:44:24,810 --> 00:44:26,960 So these higher order methods allow 650 00:44:26,960 --> 00:44:32,400 you to get to a great answer with bigger steps. 651 00:44:32,400 --> 00:44:35,390 A lot of thinking has gone into that 652 00:44:35,390 --> 00:44:43,230 and somehow it's a pretty basic problem. 653 00:44:43,230 --> 00:44:49,210 Just to mention for MATLAB, ode45 654 00:44:49,210 --> 00:44:56,070 is maybe the workhorse code to solve this type of a problem. 655 00:44:56,070 --> 00:45:01,040 And the method is not Euler. 656 00:45:01,040 --> 00:45:04,390 That would not be good enough. 657 00:45:04,390 --> 00:45:07,450 It's called Runge-Kutta. 658 00:45:07,450 --> 00:45:10,350 Two guys, Runge and Kutta, figured out 659 00:45:10,350 --> 00:45:14,020 a formula that got up to fourth order accurate. 660 00:45:14,020 --> 00:45:17,980 So that's the thing. 661 00:45:17,980 --> 00:45:22,530 And then if we looked further about this subject 662 00:45:22,530 --> 00:45:24,620 we would distinguish some equations 663 00:45:24,620 --> 00:45:27,100 that are called stiff. 664 00:45:27,100 --> 00:45:29,590 So I'll just write that word down. 665 00:45:29,590 --> 00:45:38,470 Some equations, the iteration is particularly difficult. 666 00:45:38,470 --> 00:45:40,520 You have two time scales. 667 00:45:40,520 --> 00:45:43,150 Maybe you've got things happening on a slow scale 668 00:45:43,150 --> 00:45:44,350 and a high scale. 669 00:45:44,350 --> 00:45:49,700 Multi-scale computations, that's where the subject is now. 670 00:45:49,700 --> 00:45:55,660 And so there would be separate codes with an S in their names 671 00:45:55,660 --> 00:46:02,920 suitable for these tougher problems, stiff equation. 672 00:46:02,920 --> 00:46:07,880 I guess one thing you sometimes get in the review session 673 00:46:07,880 --> 00:46:17,560 is a look outside the scope of what I can cover and ask 674 00:46:17,560 --> 00:46:20,640 homework problems about. 675 00:46:20,640 --> 00:46:29,130 I'm sure hoping that you're assembling the elements 676 00:46:29,130 --> 00:46:32,630 of computational science here. 677 00:46:32,630 --> 00:46:34,670 First, what are the questions? 678 00:46:34,670 --> 00:46:35,960 What are some answers? 679 00:46:35,960 --> 00:46:38,970 What are the issues? 680 00:46:38,970 --> 00:46:44,410 What do you have to balance to make a good decision? 681 00:46:44,410 --> 00:46:47,090 Time for another question if we like. 682 00:46:47,090 --> 00:46:50,800 Yeah, thank you. 683 00:46:50,800 --> 00:47:05,400 Stability, yeah, right. 684 00:47:05,400 --> 00:47:10,430 This here? 685 00:47:10,430 --> 00:47:12,460 First, if we want a matrix then this 686 00:47:12,460 --> 00:47:15,500 has to be a vector of unknowns. 687 00:47:15,500 --> 00:47:19,260 I'm thinking now of a system of, this is n equations. 688 00:47:19,260 --> 00:47:23,650 I've got u is a vector with n components. 689 00:47:23,650 --> 00:47:25,860 I've got n equations here. 690 00:47:25,860 --> 00:47:29,840 The notation, I can put a little arrow over it 691 00:47:29,840 --> 00:47:32,740 just to remind myself. 692 00:47:32,740 --> 00:47:38,510 And if I want to get to a matrix I better do the linear case. 693 00:47:38,510 --> 00:47:48,050 So I'll do the linear case. 694 00:47:48,050 --> 00:47:51,450 The big picture is that the new values 695 00:47:51,450 --> 00:47:54,030 come from the old values. 696 00:47:54,030 --> 00:47:56,160 There has to be a matrix multiplier. 697 00:47:56,160 --> 00:48:01,450 Anytime we have a linear process. 698 00:48:01,450 --> 00:48:06,270 So the new values come from old values by some linear map. 699 00:48:06,270 --> 00:48:12,260 A matrix is doing it. 700 00:48:12,260 --> 00:48:14,050 So there's a sort of growth matrix. 701 00:48:14,050 --> 00:48:17,750 Can I just put down some letters here? 702 00:48:17,750 --> 00:48:22,110 I won't be able to give you a complete answer. 703 00:48:22,110 --> 00:48:25,930 But this'll do it. 704 00:48:25,930 --> 00:48:34,550 So u_(n+1) is some matrix times u_n. 705 00:48:34,550 --> 00:48:38,540 That's what I wrote down this morning for a special case. 706 00:48:38,540 --> 00:48:44,540 It's gotta look like that for a linear problem. 707 00:48:44,540 --> 00:48:48,480 And let's suppose that we have this nice situation as today 708 00:48:48,480 --> 00:48:51,930 where it's the same G at every step. 709 00:48:51,930 --> 00:48:58,170 So the problem is not changing in time, it's linear, 710 00:48:58,170 --> 00:48:59,340 it's all good. 711 00:48:59,340 --> 00:49:03,680 What is the solution after n times steps compared 712 00:49:03,680 --> 00:49:06,690 to the start? 713 00:49:06,690 --> 00:49:12,760 So give me a simple formula for the solution to this step, 714 00:49:12,760 --> 00:49:15,350 step, step equation. 715 00:49:15,350 --> 00:49:19,280 If I started at initial value u_0 716 00:49:19,280 --> 00:49:24,150 and I looked to see, well what matrix gets me over n steps, 717 00:49:24,150 --> 00:49:25,840 what do I write there? 718 00:49:25,840 --> 00:49:30,110 G to the n, right, G to the n. 719 00:49:30,110 --> 00:49:36,090 So now comes the question. 720 00:49:36,090 --> 00:49:38,270 The stability question is whether-- do 721 00:49:38,270 --> 00:49:41,700 the powers of G to the nth grow? 722 00:49:41,700 --> 00:49:43,820 And here's the point. 723 00:49:43,820 --> 00:49:48,150 That the continuous problem that this came from, 724 00:49:48,150 --> 00:49:52,610 it's got its own growth or decay or oscillation. 725 00:49:52,610 --> 00:49:56,890 This guy, the discrete one, has got its. 726 00:49:56,890 --> 00:50:01,000 They're going to be close for a step or two. 727 00:50:01,000 --> 00:50:05,310 For one or two steps I'm expecting 728 00:50:05,310 --> 00:50:08,980 that this is a reasonable consistent approximation 729 00:50:08,980 --> 00:50:10,500 to my problem. 730 00:50:10,500 --> 00:50:14,560 But after I take a thousand steps, 731 00:50:14,560 --> 00:50:22,030 this one could still be close or it could have exploded. 732 00:50:22,030 --> 00:50:26,350 And that's the stability thing. 733 00:50:26,350 --> 00:50:32,710 The choice of the difference method can be be stable or not. 734 00:50:32,710 --> 00:50:36,840 And it's going to be the eigenvalues of G that 735 00:50:36,840 --> 00:50:38,630 are the best guide. 736 00:50:38,630 --> 00:50:45,930 So in the end people compute the eigenvalues of the growth 737 00:50:45,930 --> 00:51:10,330 matrix and look to see are they bigger than one or not. 738 00:51:10,330 --> 00:51:13,660 Let's close with that example because that's a good example. 739 00:51:13,660 --> 00:51:18,040 So it fits this, but not quite, because it wasn't completely 740 00:51:18,040 --> 00:51:20,260 forward or completely backward. 741 00:51:20,260 --> 00:51:23,290 And let's just write down what it was in that model problem 742 00:51:23,290 --> 00:51:26,300 and find the matrix. 743 00:51:26,300 --> 00:51:29,120 So can you remind me what I wrote today? 744 00:51:29,120 --> 00:51:41,320 So u, was it u first? u_(n+1) was u_n + delta t*v_n, right? 745 00:51:41,320 --> 00:51:46,950 And then the new velocity was the old velocity and it 746 00:51:46,950 --> 00:51:50,590 should be minus delta t times the u. 747 00:51:50,590 --> 00:51:55,390 Because our equation is, these are representing the equation-- 748 00:51:55,390 --> 00:51:59,200 u'=v is the first one. 749 00:51:59,200 --> 00:52:01,740 v'=-u is my second equation. 750 00:52:01,740 --> 00:52:03,550 So and then the point was I could 751 00:52:03,550 --> 00:52:10,260 take that because I know it already, I could take it there. 752 00:52:10,260 --> 00:52:14,800 Where is the matrix here? 753 00:52:14,800 --> 00:52:20,640 I want to find the growth matrix that tells me now-- 754 00:52:20,640 --> 00:52:29,330 My growth matrix, of course-- This is [u n, v n] and this is 755 00:52:29,330 --> 00:52:31,780 [u (n+1), v (n+1)]. 756 00:52:31,780 --> 00:52:34,550 And this is a two by two matrix. 757 00:52:34,550 --> 00:52:38,170 And I hope we can read it off. 758 00:52:38,170 --> 00:52:40,810 Or find it anyway. 759 00:52:40,810 --> 00:52:45,780 Because that's the key. 760 00:52:45,780 --> 00:52:49,280 How could we get a matrix out of these two equations? 761 00:52:49,280 --> 00:52:51,200 Let me just ask you to look at them 762 00:52:51,200 --> 00:52:58,520 and think what are we going to do. 763 00:52:58,520 --> 00:53:00,830 That's a good question. 764 00:53:00,830 --> 00:53:02,170 What shall I do? 765 00:53:02,170 --> 00:53:07,330 I would like to know the new u's, u, v from the old. 766 00:53:07,330 --> 00:53:10,720 What'll I do? 767 00:53:10,720 --> 00:53:22,610 Bring stuff onto, a u_(n+1) on its side and n on its side. 768 00:53:22,610 --> 00:53:25,050 This guy I want to get over here. 769 00:53:25,050 --> 00:53:29,300 Can I do that with erasing? 770 00:53:29,300 --> 00:53:40,620 So it's going to come over with a plus sign. 771 00:53:40,620 --> 00:53:44,730 So I guess I see here an implicit matrix acting 772 00:53:44,730 --> 00:53:48,710 on the left and an explicit matrix acting on the right. 773 00:53:48,710 --> 00:53:52,350 So I see a [u n, v n]. 774 00:53:52,350 --> 00:53:54,580 And I see my explicit matrix. 775 00:53:54,580 --> 00:53:56,730 Shall I call it E? 776 00:53:56,730 --> 00:53:58,580 That's the right sides. 777 00:53:58,580 --> 00:54:02,560 I see a one and a one and a delta t. 778 00:54:02,560 --> 00:54:09,610 And now my left side of my equation, the n+1 stuff. 779 00:54:09,610 --> 00:54:14,170 What's my implicit matrix on the left sides of the equation? 780 00:54:14,170 --> 00:54:23,600 Well, a one and a one and a plus delta t is here, right? 781 00:54:23,600 --> 00:54:31,080 And let's call that I for implicit. 782 00:54:31,080 --> 00:54:34,040 Are we close? 783 00:54:34,040 --> 00:54:36,110 I think that looks pretty good. 784 00:54:36,110 --> 00:54:38,550 What's G? 785 00:54:38,550 --> 00:54:40,980 What's the matrix G now? 786 00:54:40,980 --> 00:54:44,480 You just have to begin to develop a little faith 787 00:54:44,480 --> 00:54:46,600 that yeah, I can deal with matrices, 788 00:54:46,600 --> 00:54:51,660 I can move them around, they're under my control. 789 00:54:51,660 --> 00:54:55,140 I wanted this picture. 790 00:54:55,140 --> 00:54:58,940 I want to move everything to the right. 791 00:54:58,940 --> 00:55:03,480 What do I do to move everything to the right-hand side? 792 00:55:03,480 --> 00:55:06,040 I want that to be over there. 793 00:55:06,040 --> 00:55:07,570 It's an inverse. 794 00:55:07,570 --> 00:55:08,840 It's the inverse. 795 00:55:08,840 --> 00:55:14,720 So G, the matrix G there is, I bring I over here. 796 00:55:14,720 --> 00:55:22,040 It's the inverse of I times the E. 797 00:55:22,040 --> 00:55:25,360 And I can figure out what that matrix is. 798 00:55:25,360 --> 00:55:28,110 And I can find its eigenvalues. 799 00:55:28,110 --> 00:55:31,370 And it'll be interesting. 800 00:55:31,370 --> 00:55:33,590 So actually that's the perfect problem. 801 00:55:33,590 --> 00:55:37,010 I mean, if you want to see what's going on, 802 00:55:37,010 --> 00:55:40,580 well the book will be a good help I think, 803 00:55:40,580 --> 00:55:45,670 but that's the growth matrix for leapfrog. 804 00:55:45,670 --> 00:55:53,210 And I'll tell you the result. The eigenvalues are 805 00:55:53,210 --> 00:55:56,890 right of magnitude one, as you hope, up 806 00:55:56,890 --> 00:55:58,840 to a certain value of delta t. 807 00:55:58,840 --> 00:56:01,350 And then when delta t passes that stability 808 00:56:01,350 --> 00:56:04,710 limit the eigenvalues take off. 809 00:56:04,710 --> 00:56:08,800 So that this method is great provided 810 00:56:08,800 --> 00:56:15,410 you're not too ambitious and take too large a delta t. 811 00:56:15,410 --> 00:56:18,340 Thanks for that last question, thanks for coming.