1 00:00:00,000 --> 00:00:00,099 2 00:00:00,099 --> 00:00:02,182 The following content is provided under a Creative 3 00:00:02,182 --> 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,547 continue to offer high-quality educational resources for free. 6 00:00:09,547 --> 00:00:11,630 To make a donation or to view additional materials 7 00:00:11,630 --> 00:00:15,160 from hundreds of MIT courses, visit MIT OpenCourseWare 8 00:00:15,160 --> 00:00:21,130 at ocw.mit.edu. 9 00:00:21,130 --> 00:00:23,390 PROFESSOR STRANG: OK. 10 00:00:23,390 --> 00:00:27,400 Well, we had an election since I saw you last. 11 00:00:27,400 --> 00:00:32,100 I hope you're happy about the results. 12 00:00:32,100 --> 00:00:35,120 I'm very happy. 13 00:00:35,120 --> 00:00:36,480 Except one thing. 14 00:00:36,480 --> 00:00:40,750 There was a senator who was in 18.085. 15 00:00:40,750 --> 00:00:42,520 And he lost his seat. 16 00:00:42,520 --> 00:00:48,290 So we don't have a senator from 18.085 any more. 17 00:00:48,290 --> 00:00:51,070 It was Senator Sununu, from New Hampshire. 18 00:00:51,070 --> 00:00:53,920 So he took 18.085. 19 00:00:53,920 --> 00:00:59,350 Actually, it was a funny experience. 20 00:00:59,350 --> 00:01:02,770 So, some years ago I had to go to Washington 21 00:01:02,770 --> 00:01:08,070 to testify before a committee about increasing 22 00:01:08,070 --> 00:01:10,680 the funding for mathematics. 23 00:01:10,680 --> 00:01:13,920 So I was nervous, of course, trying to remember 24 00:01:13,920 --> 00:01:15,060 what I'm going to say. 25 00:01:15,060 --> 00:01:18,720 More money is the main point, but you 26 00:01:18,720 --> 00:01:22,090 have to say it more delicately than that. 27 00:01:22,090 --> 00:01:28,230 And so I got in, a lot of people were taking turns, 28 00:01:28,230 --> 00:01:30,660 you only get five minutes to do it. 29 00:01:30,660 --> 00:01:34,130 And so I went and sat down, waited for my turn. 30 00:01:34,130 --> 00:01:38,970 And here on the committee was my student, Senator Sununu. 31 00:01:38,970 --> 00:01:42,760 Well at that time, I think, Representative Sununu. 32 00:01:42,760 --> 00:01:45,890 So that was nice. 33 00:01:45,890 --> 00:01:48,630 He's a nice guy. 34 00:01:48,630 --> 00:01:52,870 Actually, the lobbyist who kind of guided me there, 35 00:01:52,870 --> 00:01:57,020 and found the room for me and sort of told me what to do, 36 00:01:57,020 --> 00:02:06,420 said I hope you gave him an A. And the truth is I didn't. 37 00:02:06,420 --> 00:02:09,290 So I guess you guys should all get As, just 38 00:02:09,290 --> 00:02:11,590 to be on the safe side. 39 00:02:11,590 --> 00:02:18,830 Or let me know if you're going to be in the Senate anyway. 40 00:02:18,830 --> 00:02:20,210 So there you go. 41 00:02:20,210 --> 00:02:20,950 Anyway. 42 00:02:20,950 --> 00:02:24,810 So alright. 43 00:02:24,810 --> 00:02:28,280 But he wasn't great in 18.085. 44 00:02:28,280 --> 00:02:32,240 OK, so you know what, this evening-- 45 00:02:32,240 --> 00:02:34,540 I just called the schedules office 46 00:02:34,540 --> 00:02:38,360 to confirm that it is tonight, in 54-100. 47 00:02:38,360 --> 00:02:44,160 It's not a long, difficult exam so see you at 7:30, 48 00:02:44,160 --> 00:02:50,160 or see you earlier at 4:00 for a review of everything 49 00:02:50,160 --> 00:02:52,800 that you want to ask about. 50 00:02:52,800 --> 00:02:55,970 So I won't try to do an exam review this morning; 51 00:02:55,970 --> 00:03:00,480 we've got lots to do and we're into November already. 52 00:03:00,480 --> 00:03:05,150 So I want to finish the discussion of the fast Poisson 53 00:03:05,150 --> 00:03:05,650 solver. 54 00:03:05,650 --> 00:03:10,860 Because it's just a neat idea which is so simple. 55 00:03:10,860 --> 00:03:13,560 Anytime you have a nice square grid. 56 00:03:13,560 --> 00:03:15,530 I guess the message is, anytime you 57 00:03:15,530 --> 00:03:19,480 have a nice square or rectangular grid, 58 00:03:19,480 --> 00:03:23,860 you should be thinking, use the fast Fourier transform somehow. 59 00:03:23,860 --> 00:03:27,920 And here it turns out that the eigenvectors 60 00:03:27,920 --> 00:03:32,760 are, for this problem, this K2D, so we're 61 00:03:32,760 --> 00:03:36,400 getting this matrix K2D. 62 00:03:36,400 --> 00:03:40,960 Which is of size N squared by N squared, so a large matrix. 63 00:03:40,960 --> 00:03:47,350 But its eigenvectors will be, well, 64 00:03:47,350 --> 00:03:49,690 actually they'll be sine functions 65 00:03:49,690 --> 00:03:52,670 for the K2D, the fixed-fixed. 66 00:03:52,670 --> 00:03:57,470 And they would be cosine functions for the B2D, 67 00:03:57,470 --> 00:03:58,900 free-free. 68 00:03:58,900 --> 00:04:02,950 And the point is the fast Fourier transform 69 00:04:02,950 --> 00:04:05,560 does all those fast. 70 00:04:05,560 --> 00:04:08,020 I mean, the fast Fourier transform 71 00:04:08,020 --> 00:04:11,160 is set up for the complex exponentials 72 00:04:11,160 --> 00:04:15,000 as we'll see in a couple of weeks. 73 00:04:15,000 --> 00:04:18,060 That's the most important algorithm 74 00:04:18,060 --> 00:04:21,230 I could tell you about. 75 00:04:21,230 --> 00:04:26,040 After maybe Gaussian elimination, I don't know. 76 00:04:26,040 --> 00:04:31,210 But my point here is that if you can do complex exponentials 77 00:04:31,210 --> 00:04:35,660 fast, you can do sines fast, you can do cosines fast, 78 00:04:35,660 --> 00:04:43,000 and the result will be that instead of-- I did 79 00:04:43,000 --> 00:04:46,780 an operation count when I did elimination 80 00:04:46,780 --> 00:04:49,950 in the order one, two, three, four, five, six, 81 00:04:49,950 --> 00:04:53,790 ordered by along each row. 82 00:04:53,790 --> 00:04:56,570 That gave us a matrix that I want to look at again, 83 00:04:56,570 --> 00:04:59,340 this K2D matrix. 84 00:04:59,340 --> 00:05:01,810 If I did elimination as it stands, 85 00:05:01,810 --> 00:05:04,680 I think the count was N^4. 86 00:05:04,680 --> 00:05:10,320 I think the count was, size N squared, 87 00:05:10,320 --> 00:05:15,420 I had N squared columns to work on and I think each column took 88 00:05:15,420 --> 00:05:19,020 N squared steps, so I was up to N^4. 89 00:05:19,020 --> 00:05:25,160 And that's manageable. 90 00:05:25,160 --> 00:05:28,990 2-D problems, you really can use backslash. 91 00:05:28,990 --> 00:05:35,050 But for this particular problem, using the FFT way, 92 00:05:35,050 --> 00:05:40,460 it comes down to N squared log N. So that's way better. 93 00:05:40,460 --> 00:05:41,360 Way better. 94 00:05:41,360 --> 00:05:42,780 Big saving. 95 00:05:42,780 --> 00:05:46,840 In 1-D, you don't see a saving. 96 00:05:46,840 --> 00:05:51,240 But in 2-D it's a big saving, and in 3-D an enormous saving. 97 00:05:51,240 --> 00:05:56,910 So a lot of people would like to try to use the FFT also 98 00:05:56,910 --> 00:05:59,860 when the region isn't a square. 99 00:05:59,860 --> 00:06:02,950 You can imagine all the thinking that goes into this. 100 00:06:02,950 --> 00:06:05,840 But we'll focus on the one where it's a square. 101 00:06:05,840 --> 00:06:07,840 Oh, one thing more to add. 102 00:06:07,840 --> 00:06:11,410 I spoke about reordering the unknowns. 103 00:06:11,410 --> 00:06:14,280 But you probably were wondering, OK, what's that about because I 104 00:06:14,280 --> 00:06:16,900 only just referred to it. 105 00:06:16,900 --> 00:06:21,690 Let me suggest an ordering and you 106 00:06:21,690 --> 00:06:24,460 can tell me what the matrix K2D will 107 00:06:24,460 --> 00:06:26,330 look like in this ordering. 108 00:06:26,330 --> 00:06:30,330 I'll call it the red-black ordering. 109 00:06:30,330 --> 00:06:32,790 I guess with the election just behind us 110 00:06:32,790 --> 00:06:34,870 I could call it the red-blue ordering. 111 00:06:34,870 --> 00:06:37,860 OK, red-blue ordering, OK. 112 00:06:37,860 --> 00:06:43,600 So the ordering, instead of ordering it by-- Let me draw 113 00:06:43,600 --> 00:06:50,620 this again, I'll put in a couple more, make N=4 here, 114 00:06:50,620 --> 00:06:54,630 so now I've got 16, N squared is now 16. 115 00:06:54,630 --> 00:06:57,170 So here's the idea. 116 00:06:57,170 --> 00:07:03,550 The red-blue ordering is like a checkerboard. 117 00:07:03,550 --> 00:07:05,820 The checkerboard ordering, you could think of. 118 00:07:05,820 --> 00:07:09,550 This will be one, this'll be two, this'll be three, 119 00:07:09,550 --> 00:07:13,950 this'll be four, five, six, seven, eight. 120 00:07:13,950 --> 00:07:17,290 So I've numbered from one to eight. 121 00:07:17,290 --> 00:07:21,130 And now 9 to 16 will be the other guys. 122 00:07:21,130 --> 00:07:26,700 These will be 9, 10, 11, 12, 13, 14, 15, 16. 123 00:07:26,700 --> 00:07:33,050 So suppose I do that, what K2D look like? 124 00:07:33,050 --> 00:07:36,500 Maybe you could, it's a neat example. 125 00:07:36,500 --> 00:07:40,420 It gives us one more chance to look at this matrix. 126 00:07:40,420 --> 00:07:44,640 So K2D is always going to have fours on the diagonal. 127 00:07:44,640 --> 00:07:46,010 So I have 16 fours. 128 00:07:46,010 --> 00:07:51,180 Whatever order I take, the equation at a typical point, 129 00:07:51,180 --> 00:07:55,320 like say this one, that's point number one, two. 130 00:07:55,320 --> 00:07:58,370 That's point number three, at a point number three 131 00:07:58,370 --> 00:08:02,360 I have my five point molecule with a four in the middle. 132 00:08:02,360 --> 00:08:06,080 So it'd be a four in this, on that position. 133 00:08:06,080 --> 00:08:11,230 And then I have the four guys around it, the minus ones, 134 00:08:11,230 --> 00:08:13,650 and where will they appear in the matrix? 135 00:08:13,650 --> 00:08:14,820 With this ordering. 136 00:08:14,820 --> 00:08:18,800 So you get to see the point of an ordering. 137 00:08:18,800 --> 00:08:21,640 So this was point one, point two, point three, 138 00:08:21,640 --> 00:08:24,760 I'm focusing on point three. 139 00:08:24,760 --> 00:08:28,410 It's got a four on the diagonal and then it's got a minus one, 140 00:08:28,410 --> 00:08:30,220 a minus one, a minus one, a minus one, 141 00:08:30,220 --> 00:08:32,670 where do they appear? 142 00:08:32,670 --> 00:08:34,810 Well, all those guys are what color? 143 00:08:34,810 --> 00:08:36,620 They're all color blue. 144 00:08:36,620 --> 00:08:37,120 Right? 145 00:08:37,120 --> 00:08:38,700 All the neighbors are colored blue. 146 00:08:38,700 --> 00:08:40,860 So I won't get to them until I've 147 00:08:40,860 --> 00:08:42,880 gone through the red, the eight reds, 148 00:08:42,880 --> 00:08:45,340 and then I come back to nine. 149 00:08:45,340 --> 00:08:49,180 Whatever, 11, 12, 13. 150 00:08:49,180 --> 00:08:53,360 The point is they'll all be over here. 151 00:08:53,360 --> 00:09:02,930 So this is like, you see that the only nodes that 152 00:09:02,930 --> 00:09:05,440 are next to a red node are all blue. 153 00:09:05,440 --> 00:09:08,650 And the only nodes next to a blue node are red. 154 00:09:08,650 --> 00:09:13,690 So this is filled in a little bit, that's 155 00:09:13,690 --> 00:09:16,930 where I've sort of like four diagonals of minus ones 156 00:09:16,930 --> 00:09:17,750 or something. 157 00:09:17,750 --> 00:09:19,540 But there you go. 158 00:09:19,540 --> 00:09:22,850 That gives you an idea of what a different ordering could be. 159 00:09:22,850 --> 00:09:26,010 And you see what will happen now with elimination? 160 00:09:26,010 --> 00:09:29,830 Elimination is completed already on this stuff. 161 00:09:29,830 --> 00:09:32,940 So all the-- With elimination you 162 00:09:32,940 --> 00:09:36,610 want to push the non-zeroes way to the end. 163 00:09:36,610 --> 00:09:41,770 That's sort of like the central idea is, 164 00:09:41,770 --> 00:09:43,520 it's kind of a greedy approach. 165 00:09:43,520 --> 00:09:45,820 Greedy algorithm. 166 00:09:45,820 --> 00:09:49,570 Use up zeroes while the sun's shining. 167 00:09:49,570 --> 00:09:53,500 And then near the end, where the problem is, 168 00:09:53,500 --> 00:09:56,570 elimination's reduced it to a much smaller problem, 169 00:09:56,570 --> 00:09:58,240 then you've got some work to do. 170 00:09:58,240 --> 00:10:01,740 So that's what would happen here. 171 00:10:01,740 --> 00:10:06,170 By the way there's a movie, on the 18.086 page. 172 00:10:06,170 --> 00:10:09,390 I hope some of you guys will consider taking 18.086. 173 00:10:09,390 --> 00:10:13,080 It's a smaller class, people do projects 174 00:10:13,080 --> 00:10:16,920 like creating this elimination movie. 175 00:10:16,920 --> 00:10:23,430 So that would be math.mit.edu/18.086, 176 00:10:23,430 --> 00:10:30,000 and with the movie-- has a movie of different orderings. 177 00:10:30,000 --> 00:10:32,980 That to try to figure out what's the absolute best ordering 178 00:10:32,980 --> 00:10:35,960 with the absolute least fill-in is, 179 00:10:35,960 --> 00:10:39,670 that's one of these NP-hard combinatorial problems. 180 00:10:39,670 --> 00:10:47,690 But to get an ordering that's much better than by rows 181 00:10:47,690 --> 00:10:53,490 is not only doable but should be done. 182 00:10:53,490 --> 00:10:56,680 OK, so that's the ordering for elimination. 183 00:10:56,680 --> 00:10:58,870 As this is for elimination. 184 00:10:58,870 --> 00:11:01,470 OK. 185 00:11:01,470 --> 00:11:03,960 So that's a whole world of its own. 186 00:11:03,960 --> 00:11:07,310 Ordering the thing for Gaussian elimination. 187 00:11:07,310 --> 00:11:15,850 My focus in this section 3.5, so this is Section 3.5 of the book 188 00:11:15,850 --> 00:11:20,470 and then this is Section 3.6, which is our major one. 189 00:11:20,470 --> 00:11:21,770 That's our big deal. 190 00:11:21,770 --> 00:11:25,840 But my focus in 3.5 is first to try 191 00:11:25,840 --> 00:11:28,810 to see what the 2-D matrix is. 192 00:11:28,810 --> 00:11:30,690 I mean, a big part of this course, 193 00:11:30,690 --> 00:11:34,280 I think, a big part of what I can do for you, is to, like, 194 00:11:34,280 --> 00:11:36,480 get comfortable with matrices. 195 00:11:36,480 --> 00:11:39,080 Sort of see what do you look at when you see a matrix? 196 00:11:39,080 --> 00:11:40,930 What's its shape? 197 00:11:40,930 --> 00:11:43,320 What are its properties? 198 00:11:43,320 --> 00:11:48,270 And so this K2D is our first example of a 2-D matrix, 199 00:11:48,270 --> 00:11:50,370 and it's highly structured. 200 00:11:50,370 --> 00:11:54,110 The point is we'll have K2D matrices out 201 00:11:54,110 --> 00:11:55,550 of finite elements. 202 00:11:55,550 --> 00:11:59,340 But the finite elements might be, well, they could be those. 203 00:11:59,340 --> 00:12:01,930 This could be a finite element picture. 204 00:12:01,930 --> 00:12:08,500 And then the finite element matrix on such a regular mesh 205 00:12:08,500 --> 00:12:11,000 would be quite structured too. 206 00:12:11,000 --> 00:12:15,270 But if I cut them all up into triangles 207 00:12:15,270 --> 00:12:17,780 and I have a curved region and everything, 208 00:12:17,780 --> 00:12:23,380 an unstructured mesh, then I'll still have the good properties, 209 00:12:23,380 --> 00:12:26,120 this will still be symmetric positive definite, 210 00:12:26,120 --> 00:12:27,490 all the good stuff. 211 00:12:27,490 --> 00:12:31,440 But the FFT won't come in. 212 00:12:31,440 --> 00:12:38,050 OK, so now I want to take a look again at this K2D matrix, OK? 213 00:12:38,050 --> 00:12:41,110 So one way to describe the K2D matrix 214 00:12:41,110 --> 00:12:43,570 is the way I did last time, to kind of write down 215 00:12:43,570 --> 00:12:46,310 the typical row, typical row in the middle. 216 00:12:46,310 --> 00:12:50,230 It's got a four on the diagonal and four minus ones. 217 00:12:50,230 --> 00:12:55,350 And here we've re-ordered it so the four minus ones came off. 218 00:12:55,350 --> 00:12:56,400 Came much later. 219 00:12:56,400 --> 00:13:00,600 But either way, that's what the matrix looks like. 220 00:13:00,600 --> 00:13:03,300 Let me go back to this ordering. 221 00:13:03,300 --> 00:13:09,560 And let's get 2-D, another better, clearer look at K2D. 222 00:13:09,560 --> 00:13:22,270 I want to construct K2D from K. Which is this K1D. 223 00:13:22,270 --> 00:13:26,680 I don't use that name, but here it is. 224 00:13:26,680 --> 00:13:29,000 Let me just show it to you. 225 00:13:29,000 --> 00:13:32,030 OK, so let me take the matrix that 226 00:13:32,030 --> 00:13:37,600 does the second differences in the x direction. 227 00:13:37,600 --> 00:13:42,390 This'll be an N squared by N squared matrix. 228 00:13:42,390 --> 00:13:45,620 And it'll take second differences on every row. 229 00:13:45,620 --> 00:13:47,780 Let me just write in what it'll be. 230 00:13:47,780 --> 00:13:50,120 It'll be K, it'll be a block matrix. 231 00:13:50,120 --> 00:13:53,310 K, K, n blocks. 232 00:13:53,310 --> 00:13:55,040 Each n by n. 233 00:13:55,040 --> 00:13:59,560 You see that that will be the second difference matrix? 234 00:13:59,560 --> 00:14:03,180 K takes the second differences along a row. 235 00:14:03,180 --> 00:14:06,730 This K will take the second x differences along the next row. 236 00:14:06,730 --> 00:14:09,700 Row by row, simple. 237 00:14:09,700 --> 00:14:11,970 So this is the u_xx part. 238 00:14:11,970 --> 00:14:18,940 Now what will the u_yy, the second y derivative-- 239 00:14:18,940 --> 00:14:23,460 That gives second differences up the columns, right? 240 00:14:23,460 --> 00:14:26,640 So can I see what that matrix will 241 00:14:26,640 --> 00:14:29,710 look like, second differences up the columns? 242 00:14:29,710 --> 00:14:32,290 Well, I think it will look like this. 243 00:14:32,290 --> 00:14:35,520 It will have twos on the diagonal. 244 00:14:35,520 --> 00:14:39,980 2I, 2I, 2I, this is second differences, right? 245 00:14:39,980 --> 00:14:43,020 Down to 2I. 246 00:14:43,020 --> 00:14:46,330 And next to it will be a minus the identity-- Let me write it, 247 00:14:46,330 --> 00:14:48,800 and you see if you think it looks good. 248 00:14:48,800 --> 00:14:50,670 So minus the identity. 249 00:14:50,670 --> 00:14:55,360 It's like a blown up K. Somehow. 250 00:14:55,360 --> 00:14:56,470 Right? 251 00:14:56,470 --> 00:15:02,480 I have, do you see, it's every row has got a two and two minus 252 00:15:02,480 --> 00:15:03,690 ones. 253 00:15:03,690 --> 00:15:06,670 That's from the minus one the two and the minus one 254 00:15:06,670 --> 00:15:08,840 in the vertical second difference. 255 00:15:08,840 --> 00:15:13,350 But you see how the count, you see how the numbering changed 256 00:15:13,350 --> 00:15:14,480 it from here? 257 00:15:14,480 --> 00:15:17,040 Here the neighbors were right next to each other, 258 00:15:17,040 --> 00:15:19,030 because we're ordering by rows. 259 00:15:19,030 --> 00:15:23,320 Here I have to wait a whole N to get the guy above. 260 00:15:23,320 --> 00:15:28,900 And I'm also N away from the guy below. 261 00:15:28,900 --> 00:15:34,370 So this is the two, minus one, minus one centered there, 262 00:15:34,370 --> 00:15:35,710 above and below. 263 00:15:35,710 --> 00:15:39,430 Do you see that? 264 00:15:39,430 --> 00:15:41,030 If you think about it a little it's 265 00:15:41,030 --> 00:15:43,490 not sort of difficult to see. 266 00:15:43,490 --> 00:15:47,670 And I guess the thing I want also to do, 267 00:15:47,670 --> 00:15:51,340 is to tell you that there's a neat little MATLAB command, 268 00:15:51,340 --> 00:15:54,910 or neat math idea really, and they just made a MATLAB command 269 00:15:54,910 --> 00:16:02,300 out of it, that produces this matrix and this one out of K. 270 00:16:02,300 --> 00:16:03,550 Can I tell you what this is? 271 00:16:03,550 --> 00:16:12,230 It's something you don't see in typical linear algebra courses. 272 00:16:12,230 --> 00:16:18,570 So I'm constructing K2D from K1D by, 273 00:16:18,570 --> 00:16:20,990 this is called a Kronecker product. 274 00:16:20,990 --> 00:16:26,660 It's named after a guy, some dead German. 275 00:16:26,660 --> 00:16:33,050 Or sometimes called tensor product. 276 00:16:33,050 --> 00:16:38,220 The point is, this is always the simplest 277 00:16:38,220 --> 00:16:41,830 thing to do in two dimensions or three dimensions, or so on. 278 00:16:41,830 --> 00:16:45,720 Is like product of 1-D things, like 279 00:16:45,720 --> 00:16:48,600 copy the 1-D idea both ways. 280 00:16:48,600 --> 00:16:50,650 That's all this thing is doing. 281 00:16:50,650 --> 00:16:53,440 Copying the one idea in the x direction 282 00:16:53,440 --> 00:16:55,270 and in the y direction. 283 00:16:55,270 --> 00:17:00,350 So the MATLAB command, I've got two pieces here. 284 00:17:00,350 --> 00:17:05,250 For this first piece it's kron, named after Kronecker, 285 00:17:05,250 --> 00:17:08,320 of-- Now, let's see. 286 00:17:08,320 --> 00:17:10,950 I'm going to put two N by N matrices, 287 00:17:10,950 --> 00:17:15,360 and Kronecker product is going to be a matrix, a giant matrix, 288 00:17:15,360 --> 00:17:16,510 of size N squared. 289 00:17:16,510 --> 00:17:17,590 Like these. 290 00:17:17,590 --> 00:17:20,620 OK, so I want to write the right thing in there. 291 00:17:20,620 --> 00:17:28,600 I think the right thing is the identity and K. OK, 292 00:17:28,600 --> 00:17:31,870 and so I have to explain what this tensor product, Kronecker 293 00:17:31,870 --> 00:17:32,840 product, is. 294 00:17:32,840 --> 00:17:38,900 And this guy happens to be also a Kronecker product. 295 00:17:38,900 --> 00:17:46,800 But it's K and I. So I'm just like mentioning here. 296 00:17:46,800 --> 00:17:51,960 That because if you have 2-D problems and 3-D problems 297 00:17:51,960 --> 00:17:54,930 and they're on a nice square grid so you can like just 298 00:17:54,930 --> 00:18:00,090 take products of things, this is what you want to know about. 299 00:18:00,090 --> 00:18:00,860 OK. 300 00:18:00,860 --> 00:18:03,080 So what is this Kronecker product? 301 00:18:03,080 --> 00:18:06,190 Kronecker product says take the first matrix, 302 00:18:06,190 --> 00:18:13,360 I. It's N by N. Just N by N, that's the identity. 303 00:18:13,360 --> 00:18:20,170 And now take this K and multiply every one of those numbers, 304 00:18:20,170 --> 00:18:24,270 these are all numbers, let me put more numbers in, 305 00:18:24,270 --> 00:18:26,750 so I've got 16 numbers. 306 00:18:26,750 --> 00:18:31,200 This is going to work for this mesh that has 307 00:18:31,200 --> 00:18:33,280 four guys in each direction. 308 00:18:33,280 --> 00:18:35,340 And four directions. 309 00:18:35,340 --> 00:18:36,630 Four levels. 310 00:18:36,630 --> 00:18:40,840 So I is four by four, and K is four by four 311 00:18:40,840 --> 00:18:46,160 and now, each number here gets multiplied by K. So 312 00:18:46,160 --> 00:18:51,060 because of all those zeroes I get just K, K, K, K. Which 313 00:18:51,060 --> 00:18:53,310 is exactly what I wanted. 314 00:18:53,310 --> 00:18:56,260 So that Kronecker product just-- In one step 315 00:18:56,260 --> 00:18:58,680 you've created an N squared by N squared matrix 316 00:18:58,680 --> 00:19:05,030 that you really would not want to type in entry by entry. 317 00:19:05,030 --> 00:19:07,040 That would be a horrible idea. 318 00:19:07,040 --> 00:19:10,210 OK, and if I follow the same principle here, 319 00:19:10,210 --> 00:19:12,910 I'll take the Kronecker product here, 320 00:19:12,910 --> 00:19:17,250 as I start with a matrix K, so I start with two, 321 00:19:17,250 --> 00:19:23,160 minus one, minus one; two, minus one, minus one; two, minus one, 322 00:19:23,160 --> 00:19:25,190 minus one; two. 323 00:19:25,190 --> 00:19:30,420 That's my K, and now what's the Kronecker idea? 324 00:19:30,420 --> 00:19:36,230 Each of those numbers gets multiplied by this matrix. 325 00:19:36,230 --> 00:19:41,670 So that two becomes 2I, minus one becomes minus I, minus one 326 00:19:41,670 --> 00:19:44,840 becomes minus I, it all clicks. 327 00:19:44,840 --> 00:19:53,260 And it's producing exactly the u_yy part, the second part. 328 00:19:53,260 --> 00:19:58,380 So that's the good construction, just to tell you about. 329 00:19:58,380 --> 00:20:03,230 And the beauty is, this is just like cooked up, 330 00:20:03,230 --> 00:20:05,950 set up for separation of variables. 331 00:20:05,950 --> 00:20:08,580 If I want to know the eigenvalues 332 00:20:08,580 --> 00:20:15,020 and the eigenvectors of this thing, 333 00:20:15,020 --> 00:20:18,650 I start by knowing the eigenvalues and eigenvectors 334 00:20:18,650 --> 00:20:22,800 of K. Can you remind me what those are? 335 00:20:22,800 --> 00:20:26,030 We should remember them. 336 00:20:26,030 --> 00:20:30,370 So, anybody remember eigenvectors of K? 337 00:20:30,370 --> 00:20:34,020 Well, this is going back to Section 1.5, 338 00:20:34,020 --> 00:20:35,710 way early in the semester. 339 00:20:35,710 --> 00:20:40,990 And there's a lot of writing involved 340 00:20:40,990 --> 00:20:43,190 and I probably didn't do it all. 341 00:20:43,190 --> 00:20:47,050 But let me remind you of the idea. 342 00:20:47,050 --> 00:20:50,670 We guessed those eigenvectors. 343 00:20:50,670 --> 00:20:52,690 And how did we guess them? 344 00:20:52,690 --> 00:20:57,220 We guessed them by comparing this difference equation 345 00:20:57,220 --> 00:20:59,230 to the differential equation. 346 00:20:59,230 --> 00:21:01,970 So we're in 1-D now, I'm just reminding you 347 00:21:01,970 --> 00:21:03,870 of what we did a long time ago. 348 00:21:03,870 --> 00:21:06,500 OK, so what did we do? 349 00:21:06,500 --> 00:21:10,270 I want to know the eigenvectors of these guys. 350 00:21:10,270 --> 00:21:14,010 So I better know the eigenvectors of the 1-D one 351 00:21:14,010 --> 00:21:14,510 first. 352 00:21:14,510 --> 00:21:17,610 OK, so what did we do in 1-D? 353 00:21:17,610 --> 00:21:22,610 We found the eigenvectors of K by looking first 354 00:21:22,610 --> 00:21:28,550 at the differential equation -u''=lambda*u with-- 355 00:21:28,550 --> 00:21:34,009 And remember we're talking about the fixed-fixed here. 356 00:21:34,009 --> 00:21:35,550 And anybody remember the eigenvectors 357 00:21:35,550 --> 00:21:40,530 of this guy, eigenfunctions I guess I should say for those? 358 00:21:40,530 --> 00:21:44,740 So sines and cosines look good here, right? 359 00:21:44,740 --> 00:21:46,580 Because you take their second derivative, 360 00:21:46,580 --> 00:21:48,360 it brings down the constant. 361 00:21:48,360 --> 00:21:52,990 And then do I want sines or cosines? 362 00:21:52,990 --> 00:21:54,650 Looking at the boundary conditions, 363 00:21:54,650 --> 00:21:56,250 that's going to tell me everything. 364 00:21:56,250 --> 00:22:00,540 I want sines, cosines are wiped out by this first condition 365 00:22:00,540 --> 00:22:02,400 that u(0) should be zero. 366 00:22:02,400 --> 00:22:07,260 And then the sine has to come back to zero at one, 367 00:22:07,260 --> 00:22:16,430 so the eigenfunctions were u equals the sine of something, 368 00:22:16,430 --> 00:22:17,940 I think. 369 00:22:17,940 --> 00:22:21,610 I want a multiple of pi, right? pi*k*x. 370 00:22:21,610 --> 00:22:24,520 371 00:22:24,520 --> 00:22:26,340 I think that would be right. 372 00:22:26,340 --> 00:22:30,400 Because at x=1, that's come back to zero. 373 00:22:30,400 --> 00:22:35,030 And the eigenvalue lambda, if I just plug that in, two 374 00:22:35,030 --> 00:22:38,310 derivatives bring down pi*k twice. 375 00:22:38,310 --> 00:22:41,860 And with a minus, and that cancels that minus. 376 00:22:41,860 --> 00:22:45,530 So the eigenvalues were pi squared k squared. 377 00:22:45,530 --> 00:22:48,810 And that's the beautiful construction 378 00:22:48,810 --> 00:22:53,630 for differential equations. 379 00:22:53,630 --> 00:22:56,330 And these eigenfunctions are a complete set, 380 00:22:56,330 --> 00:22:57,730 it's all wonderful. 381 00:22:57,730 --> 00:23:03,401 So that's a model problem of what classical applied math 382 00:23:03,401 --> 00:23:05,400 does for Bessel's equation, Legendre's equation, 383 00:23:05,400 --> 00:23:09,790 a whole long list of things. 384 00:23:09,790 --> 00:23:13,120 Now, note all those equations that I just 385 00:23:13,120 --> 00:23:15,820 mentioned would have finite difference analogs. 386 00:23:15,820 --> 00:23:20,820 But to my knowledge, it's only this one, this simplest, best 387 00:23:20,820 --> 00:23:24,150 one of all, we could call it the Fourier equation 388 00:23:24,150 --> 00:23:26,170 if we needed a name for it. 389 00:23:26,170 --> 00:23:27,332 I just thought of that. 390 00:23:27,332 --> 00:23:28,290 That sounds good to me. 391 00:23:28,290 --> 00:23:29,630 Fourier equation. 392 00:23:29,630 --> 00:23:30,220 OK. 393 00:23:30,220 --> 00:23:33,280 So what's great about this one is 394 00:23:33,280 --> 00:23:36,780 that the eigenvectors in the matrix case 395 00:23:36,780 --> 00:23:41,420 are just found by sampling these functions. 396 00:23:41,420 --> 00:23:44,360 You're right on the dot if you just sample these functions. 397 00:23:44,360 --> 00:23:49,410 So, for K, the eigenvectors, what do I call eigenvectors? 398 00:23:49,410 --> 00:23:53,650 Maybe y's, I think I sometimes call them y. 399 00:23:53,650 --> 00:24:00,740 So a typical eigenvector y would be a sine vector. 400 00:24:00,740 --> 00:24:08,080 I'm sampling it at, let's see, can I use h for this step size? 401 00:24:08,080 --> 00:24:14,200 So h is 1/(n+1). 402 00:24:14,200 --> 00:24:18,460 As we saw in the past. h is 1/(n+1). 403 00:24:18,460 --> 00:24:28,290 So a typical eigenvector would sample this thing at h, 2h, 2h, 404 00:24:28,290 --> 00:24:32,200 2h, sin(2*pi*k*h), and so on, dot dot dot dot. 405 00:24:32,200 --> 00:24:34,080 And that would be an eigenvector. 406 00:24:34,080 --> 00:24:37,760 That would be the eigenvector number k, actually. 407 00:24:37,760 --> 00:24:42,160 And do you see that that sort of eigenvector is well set up. 408 00:24:42,160 --> 00:24:46,560 It's going to work because it ends, where does it end? 409 00:24:46,560 --> 00:24:50,980 Who's the last person, the last component of this eigenvector? 410 00:24:50,980 --> 00:24:57,030 It's sin(N*pi*k*h). 411 00:24:57,030 --> 00:25:00,950 Sorry about all the symbols, but compared to most eigenvectors 412 00:25:00,950 --> 00:25:03,320 this is, like, the greatest. 413 00:25:03,320 --> 00:25:06,660 OK, now why do I like that? 414 00:25:06,660 --> 00:25:10,920 Because the pattern, what would be the next one 415 00:25:10,920 --> 00:25:13,880 if there was an N plus first? 416 00:25:13,880 --> 00:25:18,230 If there was an N plus first component, what would it be? 417 00:25:18,230 --> 00:25:23,650 What would be the sine of (N+1)*pi*k*h? 418 00:25:23,650 --> 00:25:25,500 That's the golden question. 419 00:25:25,500 --> 00:25:29,740 What would be, I'm trying to say that these have a nice pattern 420 00:25:29,740 --> 00:25:35,080 because the guy that's-- the next person here would be 421 00:25:35,080 --> 00:25:40,040 sin((N+1)*pi*k*h), which is what? 422 00:25:40,040 --> 00:25:42,120 So N+1 is in there. 423 00:25:42,120 --> 00:25:45,730 And h is in there, so what do I get from those guys? 424 00:25:45,730 --> 00:25:53,940 The (N+1)h is just one, right? (N+1)h carries me all the way 425 00:25:53,940 --> 00:25:55,900 to the end. 426 00:25:55,900 --> 00:25:58,485 That's a guy that's out, it's not in our matrix 427 00:25:58,485 --> 00:26:00,610 because that's the part, that's a known one, that's 428 00:26:00,610 --> 00:26:03,860 a zero in a fixed boundary condition. 429 00:26:03,860 --> 00:26:09,630 So like, the next guy would be sine (N+1)h, that's one. 430 00:26:09,630 --> 00:26:11,160 sin(pi*k). 431 00:26:11,160 --> 00:26:12,090 And what is sin(pi*k)? 432 00:26:12,090 --> 00:26:14,810 433 00:26:14,810 --> 00:26:17,640 The sine of pi*k is always? 434 00:26:17,640 --> 00:26:18,420 Zero. 435 00:26:18,420 --> 00:26:22,310 So we're getting it right, like, the guy that 436 00:26:22,310 --> 00:26:25,540 got knocked off following this pattern will be zero. 437 00:26:25,540 --> 00:26:29,230 And what about the guy that was knocked off of that end? 438 00:26:29,230 --> 00:26:31,670 If this was sin(2pi*k*h), and sin(pi*k*h), 439 00:26:31,670 --> 00:26:35,580 this would be sin(0pi*k*h), which would be? 440 00:26:35,580 --> 00:26:38,220 Also zero, sin(0). 441 00:26:38,220 --> 00:26:44,540 So, anyway you could check just by, it takes a little patience 442 00:26:44,540 --> 00:26:50,270 with trig identities, if I multiply K by that vector, 443 00:26:50,270 --> 00:26:53,840 the pattern keeps going, the two minus one, minus one, 444 00:26:53,840 --> 00:26:56,990 you know at a typical point I'm going to have two of these, 445 00:26:56,990 --> 00:26:59,860 minus one of these, minus one of these. 446 00:26:59,860 --> 00:27:01,840 And it'll look good. 447 00:27:01,840 --> 00:27:05,590 And when I get to the end I'll have two minus one of these. 448 00:27:05,590 --> 00:27:08,030 The pattern will still hold, because the minus one 449 00:27:08,030 --> 00:27:10,430 of these I can say is there. 450 00:27:10,430 --> 00:27:13,080 But it is a zero, so it's OK. 451 00:27:13,080 --> 00:27:14,210 And similarly here. 452 00:27:14,210 --> 00:27:19,790 Anyway, the pattern's good and the eigenvalue is? 453 00:27:19,790 --> 00:27:20,420 Something. 454 00:27:20,420 --> 00:27:22,700 OK, it has some formula. 455 00:27:22,700 --> 00:27:25,580 It's not going to be exactly this guy. 456 00:27:25,580 --> 00:27:27,770 Because we're taking differences of sines 457 00:27:27,770 --> 00:27:29,740 and not derivatives of sines. 458 00:27:29,740 --> 00:27:31,910 So it has some formula. 459 00:27:31,910 --> 00:27:35,352 Tell me what you would know about lambda. 460 00:27:35,352 --> 00:27:37,060 I'm not going to ask you for the formula, 461 00:27:37,060 --> 00:27:38,620 I'm going to write it down. 462 00:27:38,620 --> 00:27:42,380 Tell me, before I write it down, or I'll write it down 463 00:27:42,380 --> 00:27:43,450 and then you can tell me. 464 00:27:43,450 --> 00:27:45,740 I have two on the diagonal, so that's just 465 00:27:45,740 --> 00:27:47,120 going to give me a two. 466 00:27:47,120 --> 00:27:50,280 And then the guy on the left and the guy on the right, two, 467 00:27:50,280 --> 00:27:54,180 two with minus ones I think gives two, 468 00:27:54,180 --> 00:28:01,410 I think it turns out to be a cosine of k-- a k has 469 00:28:01,410 --> 00:28:03,840 to be in there, a pi has to be in there, and h. 470 00:28:03,840 --> 00:28:07,280 I think that'll be it. 471 00:28:07,280 --> 00:28:09,290 I think that's the eigenvalue. 472 00:28:09,290 --> 00:28:13,800 That's the k-th eigenvalue to go with this eigenvector. 473 00:28:13,800 --> 00:28:16,570 What do you notice about two minus two times 474 00:28:16,570 --> 00:28:19,440 the cosine of something? 475 00:28:19,440 --> 00:28:20,060 What is it? 476 00:28:20,060 --> 00:28:24,810 Positive, negative, zero, what's up? 477 00:28:24,810 --> 00:28:28,280 Two minus to times a cosine is always? 478 00:28:28,280 --> 00:28:29,690 Positive. 479 00:28:29,690 --> 00:28:34,120 What does that tell us about K that we already knew? 480 00:28:34,120 --> 00:28:35,780 It's positive definite, right? 481 00:28:35,780 --> 00:28:38,650 All eigenvalues, here we actually know what they all 482 00:28:38,650 --> 00:28:42,360 are, they're all positive. 483 00:28:42,360 --> 00:28:43,980 I'm never going to get zero here. 484 00:28:43,980 --> 00:28:53,180 These k*pi*h's are not hitting the ones where the cosine is 485 00:28:53,180 --> 00:28:57,230 one and, of course, you can imagine. 486 00:28:57,230 --> 00:28:59,120 So I started this sentence and realized 487 00:28:59,120 --> 00:29:02,280 I should add another sentence. 488 00:29:02,280 --> 00:29:04,870 These are all positive. 489 00:29:04,870 --> 00:29:05,860 We expected that. 490 00:29:05,860 --> 00:29:08,560 We knew that K was a positive definite matrix. 491 00:29:08,560 --> 00:29:10,440 All its eigenvalues are positive, 492 00:29:10,440 --> 00:29:13,650 and now we actually know what they are. 493 00:29:13,650 --> 00:29:19,850 And if I had the matrix B instead, for a free-free one? 494 00:29:19,850 --> 00:29:22,410 Then this formula would change a little bit. 495 00:29:22,410 --> 00:29:28,070 And what would be different about B, the free-free matrix? 496 00:29:28,070 --> 00:29:31,820 Its eigenvectors would be maybe at half angles 497 00:29:31,820 --> 00:29:33,880 or some darned thing happens. 498 00:29:33,880 --> 00:29:36,780 And so we get something slightly different here. 499 00:29:36,780 --> 00:29:40,430 Maybe h is 1/n for that, I've forgotten. 500 00:29:40,430 --> 00:29:44,170 And what's the deal with the free-free K? 501 00:29:44,170 --> 00:29:48,400 One of the eigenvalues is zero. 502 00:29:48,400 --> 00:29:53,690 The free-free is the positive semi-definite example. 503 00:29:53,690 --> 00:30:00,340 OK, that was like a quick review of stuff we did earlier. 504 00:30:00,340 --> 00:30:04,700 And so I'm coming back to that early point in the book, 505 00:30:04,700 --> 00:30:11,820 because of this great fact that my eigenvectors are sines. 506 00:30:11,820 --> 00:30:14,940 So the point is, my eigenvectors being 507 00:30:14,940 --> 00:30:18,760 sines, that just lights up a light saying 508 00:30:18,760 --> 00:30:21,170 use the fast Fourier transform. 509 00:30:21,170 --> 00:30:25,650 You've got a matrix full of sine vectors. 510 00:30:25,650 --> 00:30:29,340 Your eigenvector matrix is a sine transform. 511 00:30:29,340 --> 00:30:34,470 It's golden, so use it. 512 00:30:34,470 --> 00:30:38,440 So I'll just remember then how, recall that-- So what are 513 00:30:38,440 --> 00:30:43,040 the eigenvectors in 2-D? 514 00:30:43,040 --> 00:30:47,900 First of all, so let's go to 2-D. 515 00:30:47,900 --> 00:30:51,230 Let me do the continuous one first. 516 00:30:51,230 --> 00:30:57,470 Yeah, -u_xx-u_yy=lambda*u. 517 00:30:57,470 --> 00:31:01,720 The eigenvalue problem for Laplace's equation now in 2-D, 518 00:31:01,720 --> 00:31:05,340 and again I'm going to make it on the square. 519 00:31:05,340 --> 00:31:07,610 The unit square. 520 00:31:07,610 --> 00:31:10,210 And I'm going to have zero boundary conditions. 521 00:31:10,210 --> 00:31:13,830 Fixed-fixed. 522 00:31:13,830 --> 00:31:18,730 Anybody want to propose an eigenfunction for the 2-D 523 00:31:18,730 --> 00:31:20,270 problem? 524 00:31:20,270 --> 00:31:23,810 So the 2-D one, the whole idea is hey, 525 00:31:23,810 --> 00:31:27,620 this square is like a product of intervals somehow. 526 00:31:27,620 --> 00:31:32,160 We know the answer in each direction. 527 00:31:32,160 --> 00:31:38,950 What do you figure, what would be a good eigenfunction u(x,y)? 528 00:31:38,950 --> 00:31:43,400 Or eigenfunction, yeah, u(x,y). 529 00:31:43,400 --> 00:31:46,610 For this problem? 530 00:31:46,610 --> 00:31:49,350 What do you think? 531 00:31:49,350 --> 00:31:55,040 This is like the-- The older courses on applied math 532 00:31:55,040 --> 00:31:58,810 did this until you were blue in the face. 533 00:31:58,810 --> 00:32:02,230 Because there wasn't finite elements and good 534 00:32:02,230 --> 00:32:03,630 stuff at that time. 535 00:32:03,630 --> 00:32:07,190 It was exact formulas. 536 00:32:07,190 --> 00:32:09,710 You wondered about exact eigenfunctions 537 00:32:09,710 --> 00:32:13,210 and for this problem variables separate. 538 00:32:13,210 --> 00:32:20,390 And you get u(x) is the product of sine, of this guy, 539 00:32:20,390 --> 00:32:27,020 sin(pi*k*x), times the sine of pi*l*y. 540 00:32:27,020 --> 00:32:30,300 541 00:32:30,300 --> 00:32:34,890 Well, once you have the idea that it might look like that, 542 00:32:34,890 --> 00:32:37,530 you just plug it in to see, does it really work? 543 00:32:37,530 --> 00:32:40,210 And what's the eigenvalue? 544 00:32:40,210 --> 00:32:42,600 So I claim that that's a good eigenfunction function 545 00:32:42,600 --> 00:32:46,180 and I need, it's got two indices, k and l, 546 00:32:46,180 --> 00:32:47,140 two frequencies. 547 00:32:47,140 --> 00:32:50,270 It's got an x frequency and a y frequency. 548 00:32:50,270 --> 00:32:55,660 So I need double index. k and l will go, yeah, all the way out 549 00:32:55,660 --> 00:32:57,990 to infinity in the continuous problem. 550 00:32:57,990 --> 00:32:59,800 And what's the eigenvector? 551 00:32:59,800 --> 00:33:02,400 Can you plug this guy in? 552 00:33:02,400 --> 00:33:05,120 What happens when you plug that in? 553 00:33:05,120 --> 00:33:11,420 Take the second x derivative, what happens? 554 00:33:11,420 --> 00:33:14,430 A constant comes out and what's the constant? 555 00:33:14,430 --> 00:33:17,140 pi squared k squared. 556 00:33:17,140 --> 00:33:19,750 Then plug it into that term. 557 00:33:19,750 --> 00:33:21,690 A constant comes out again. 558 00:33:21,690 --> 00:33:25,740 What's that constant? pi squared l squared. 559 00:33:25,740 --> 00:33:27,380 They come out with a minus and then 560 00:33:27,380 --> 00:33:31,280 you already built in the minus, so that they've made it a plus. 561 00:33:31,280 --> 00:33:36,860 So the lambda_kl is just pi squared k squared, 562 00:33:36,860 --> 00:33:41,830 plus pi squared l squared. 563 00:33:41,830 --> 00:33:45,300 You see how it's going? 564 00:33:45,300 --> 00:33:48,510 If we knew it in 1-D now we get it in 2-D, 565 00:33:48,510 --> 00:33:50,820 practically for free. 566 00:33:50,820 --> 00:33:53,170 Just the idea of doing this. 567 00:33:53,170 --> 00:33:56,450 OK, and now I'm going to do it for finite differences. 568 00:33:56,450 --> 00:34:04,180 So now I have K2D and I want to ask you about its eigenvectors, 569 00:34:04,180 --> 00:34:05,870 and what do you think they are? 570 00:34:05,870 --> 00:34:08,290 Well, of course, they're just like those. 571 00:34:08,290 --> 00:34:17,730 They're just, the eigenvectors, shall I call them z_kl? 572 00:34:17,730 --> 00:34:19,660 So these will be the eigenvectors. 573 00:34:19,660 --> 00:34:29,090 The eigenvectors z_kl will be, their components-- I 574 00:34:29,090 --> 00:34:31,370 don't even know the best way to write them. 575 00:34:31,370 --> 00:34:35,410 The trouble is this matrix is of size N squared. 576 00:34:35,410 --> 00:34:38,160 Its eigenvectors have got N squared components, 577 00:34:38,160 --> 00:34:39,120 and what are they? 578 00:34:39,120 --> 00:34:41,020 Just you could tell me in words. 579 00:34:41,020 --> 00:34:42,840 What do you figure are going to be 580 00:34:42,840 --> 00:34:46,030 the components of the eigenvectors in K2D 581 00:34:46,030 --> 00:34:51,630 when you know them in 1-D? 582 00:34:51,630 --> 00:34:54,350 Products, of course. 583 00:34:54,350 --> 00:35:00,330 This construction, however I write it, is just like this. 584 00:35:00,330 --> 00:35:05,620 z_kl, a typical component, typical components-- 585 00:35:05,620 --> 00:35:12,520 So the components of the eigenvectors are products 586 00:35:12,520 --> 00:35:25,450 of these guys, like sin(k*pi*h), something like that. 587 00:35:25,450 --> 00:35:28,380 I've got indices that I don't want to get into. 588 00:35:28,380 --> 00:35:30,860 Just damn it, I'll just put that. 589 00:35:30,860 --> 00:35:34,450 Sine here or something, right. 590 00:35:34,450 --> 00:35:37,760 We could try to sort out the indices, 591 00:35:37,760 --> 00:35:45,360 the truth is a kron operation does it for us. 592 00:35:45,360 --> 00:35:50,390 So all I'm saying is we've got an eigenvector with N 593 00:35:50,390 --> 00:35:53,260 components in the x direction. 594 00:35:53,260 --> 00:35:57,610 We've got another one with index l, N components in the y 595 00:35:57,610 --> 00:35:58,360 direction. 596 00:35:58,360 --> 00:36:02,340 Multiply these N guys by these N guys, you get N squared guys. 597 00:36:02,340 --> 00:36:04,650 Whatever order you write them in. 598 00:36:04,650 --> 00:36:07,290 And that's the eigenvector. 599 00:36:07,290 --> 00:36:15,540 And then the eigenvalue is, so the eigenvalue will be, 600 00:36:15,540 --> 00:36:16,700 well what do we got? 601 00:36:16,700 --> 00:36:26,540 We have a second x difference, so it will be a 2-2cos(k*pi*h). 602 00:36:26,540 --> 00:36:29,360 From the xx term. 603 00:36:29,360 --> 00:36:38,540 And it'll plus the other term will be a 2-2cos(l*pi*h). 604 00:36:38,540 --> 00:36:40,390 That's cool, yeah. 605 00:36:40,390 --> 00:36:47,070 I didn't get into writing the details of the eigenvector, 606 00:36:47,070 --> 00:36:48,310 that's a mess. 607 00:36:48,310 --> 00:36:49,370 This is not a mess. 608 00:36:49,370 --> 00:36:51,290 This is nice. 609 00:36:51,290 --> 00:36:52,320 What do I see again? 610 00:36:52,320 --> 00:36:54,900 I see four coming from the diagonal. 611 00:36:54,900 --> 00:36:59,410 I see two minus ones coming from left and right. 612 00:36:59,410 --> 00:37:03,420 I see two minus ones coming from up and below. 613 00:37:03,420 --> 00:37:07,400 And do I see a positive number? 614 00:37:07,400 --> 00:37:08,190 You bet. 615 00:37:08,190 --> 00:37:11,630 Right, this is positive, this is positive. 616 00:37:11,630 --> 00:37:12,900 Sum is positive. 617 00:37:12,900 --> 00:37:17,320 The sum of two positive definite matrices is positive definite. 618 00:37:17,320 --> 00:37:23,400 I know everything about K. And the fast Fourier transform 619 00:37:23,400 --> 00:37:25,720 makes all those calculations possible. 620 00:37:25,720 --> 00:37:30,090 So maybe I, just to conclude this subject, 621 00:37:30,090 --> 00:37:34,340 would be to remind you, how do you 622 00:37:34,340 --> 00:37:39,320 use the eigenvalues and eigenvectors 623 00:37:39,320 --> 00:37:43,860 in solving the equation? 624 00:37:43,860 --> 00:37:46,200 I guess I'd better put that on a board. 625 00:37:46,200 --> 00:37:48,960 But this is what we did last time. 626 00:37:48,960 --> 00:37:58,130 So the final step would be how do I solve (K2D)U=F? 627 00:37:58,130 --> 00:38:01,340 You remember, what were the three steps? 628 00:38:01,340 --> 00:38:05,030 I do really want you to learn those three steps. 629 00:38:05,030 --> 00:38:08,420 It's the way eigenvectors and eigenvalues are used. 630 00:38:08,420 --> 00:38:10,960 It's the whole point of finding them. 631 00:38:10,960 --> 00:38:16,850 The whole point of finding them is to split this problem into N 632 00:38:16,850 --> 00:38:21,440 squared little 1-D problems, where each eigenvector is just 633 00:38:21,440 --> 00:38:23,530 doing its own thing. 634 00:38:23,530 --> 00:38:24,630 So what do you do? 635 00:38:24,630 --> 00:38:30,460 You write F as a combination, with some coefficients c_kl, 636 00:38:30,460 --> 00:38:33,690 of the eigenvectors y_kl. 637 00:38:33,690 --> 00:38:35,560 So these are vectors. 638 00:38:35,560 --> 00:38:38,700 Put an arrow over them just to emphasize. 639 00:38:38,700 --> 00:38:39,770 Those are vectors. 640 00:38:39,770 --> 00:38:43,500 Then what's the answer, let's skip the middle step 641 00:38:43,500 --> 00:38:44,850 which was so easy. 642 00:38:44,850 --> 00:38:46,110 Tell me the answer. 643 00:38:46,110 --> 00:38:49,760 Supposed the right-hand side is a combination of eigenvectors. 644 00:38:49,760 --> 00:38:53,780 Then the left-hand side, the answer, 645 00:38:53,780 --> 00:38:56,320 is also a combination of eigenvectors. 646 00:38:56,320 --> 00:39:00,080 And just tell me, what are the coefficients 647 00:39:00,080 --> 00:39:03,730 in that combination? 648 00:39:03,730 --> 00:39:10,390 This is like the whole idea is on two simple lines here. 649 00:39:10,390 --> 00:39:14,570 The coefficient there is? 650 00:39:14,570 --> 00:39:18,710 What do I have? c_kl, does that come in? 651 00:39:18,710 --> 00:39:22,840 Yes, because c_kl tells me how much of this eigenvector 652 00:39:22,840 --> 00:39:24,980 is here. 653 00:39:24,980 --> 00:39:28,190 But now, what else comes in? lambda_kl, 654 00:39:28,190 --> 00:39:30,480 and what do I do with that? 655 00:39:30,480 --> 00:39:35,290 Divide by it, because when I multiply that'll multiply by it 656 00:39:35,290 --> 00:39:40,770 and bring back F. So there you go. 657 00:39:40,770 --> 00:39:43,870 That's the-- This U is a vector, of course. 658 00:39:43,870 --> 00:39:45,990 These are all vectors. 659 00:39:45,990 --> 00:39:51,710 2-D, we'll give them an arrow, just as 660 00:39:51,710 --> 00:39:54,560 a reminder that these are vectors with N squared 661 00:39:54,560 --> 00:39:55,220 components. 662 00:39:55,220 --> 00:39:57,500 They're giant vectors, but the point 663 00:39:57,500 --> 00:40:02,000 is this y_kl, its N squared components are just products, 664 00:40:02,000 --> 00:40:04,800 as we saw here, of the 1-D problem. 665 00:40:04,800 --> 00:40:10,130 So the fast Fourier transform, the 2-D fast Fourier transform 666 00:40:10,130 --> 00:40:11,840 just takes off. 667 00:40:11,840 --> 00:40:17,530 Takes off and gives you this fantastic speed. 668 00:40:17,530 --> 00:40:20,200 So that's absolutely the right way to solve the problem. 669 00:40:20,200 --> 00:40:23,260 And everybody sees that picture? 670 00:40:23,260 --> 00:40:25,190 Don't forget that picture. 671 00:40:25,190 --> 00:40:28,490 That's like a nice part of this subject, 672 00:40:28,490 --> 00:40:34,390 is to get-- It's formulas and not code. 673 00:40:34,390 --> 00:40:37,320 But it's easily turned into code. 674 00:40:37,320 --> 00:40:41,720 Because the FFT and the sine transform are all coded. 675 00:40:41,720 --> 00:40:44,170 Actually, Professor Johnson in the Math Department, 676 00:40:44,170 --> 00:40:48,680 he created the best FFT code there is. 677 00:40:48,680 --> 00:40:49,640 Do you know that? 678 00:40:49,640 --> 00:40:51,150 I'll just mention. 679 00:40:51,150 --> 00:40:59,080 His code is called FFTW, Fastest Fourier Transform in the West, 680 00:40:59,080 --> 00:41:03,810 and the point is it's set up to be fast on whatever computer, 681 00:41:03,810 --> 00:41:06,160 whatever architecture you're using. 682 00:41:06,160 --> 00:41:07,990 It figures out what that is. 683 00:41:07,990 --> 00:41:11,130 And optimizes the code for that. 684 00:41:11,130 --> 00:41:13,460 And gives you the answer. 685 00:41:13,460 --> 00:41:14,960 OK. 686 00:41:14,960 --> 00:41:19,220 That's Part 2 complete, of Section 3.5. 687 00:41:19,220 --> 00:41:22,530 I guess I'm hoping after we get through the quiz, 688 00:41:22,530 --> 00:41:29,770 the next natural step would be some MATLAB, right? 689 00:41:29,770 --> 00:41:36,480 We really should have some MATLAB case of doing this. 690 00:41:36,480 --> 00:41:39,060 I haven't thought of it, but I'll try. 691 00:41:39,060 --> 00:41:41,600 And some MATLAB for finite elements. 692 00:41:41,600 --> 00:41:47,140 And there's a lot of finite element code 693 00:41:47,140 --> 00:41:52,690 on the course page, ready to download. 694 00:41:52,690 --> 00:41:55,130 But now we have to understand it. 695 00:41:55,130 --> 00:41:57,930 Are you ready to tackle, so in ten minutes 696 00:41:57,930 --> 00:42:02,860 we can get the central idea of finite elements in 2-D, 697 00:42:02,860 --> 00:42:07,620 and then after the quiz, when our minds are clear again, 698 00:42:07,620 --> 00:42:13,750 we'll do it properly Friday. 699 00:42:13,750 --> 00:42:17,170 This is asking you a lot, but can I do it? 700 00:42:17,170 --> 00:42:22,840 Can I go to finite elements in 2-D? 701 00:42:22,840 --> 00:42:25,420 OK. 702 00:42:25,420 --> 00:42:26,600 Oh, I have a choice. 703 00:42:26,600 --> 00:42:27,990 Big, big choice. 704 00:42:27,990 --> 00:42:31,040 I could use triangles, or quads. 705 00:42:31,040 --> 00:42:35,200 That picture, this picture would naturally set up for quads. 706 00:42:35,200 --> 00:42:37,960 Let me start with triangles. 707 00:42:37,960 --> 00:42:46,450 So I have some region with lots of triangles here. 708 00:42:46,450 --> 00:42:48,270 Got to have some interior points, 709 00:42:48,270 --> 00:42:51,410 or I'm not going to have any unknowns. 710 00:42:51,410 --> 00:42:56,090 Gosh, that's a big mesh with very little unknown. 711 00:42:56,090 --> 00:43:01,410 Let me put in another few here. 712 00:43:01,410 --> 00:43:02,450 Have I got enough? 713 00:43:02,450 --> 00:43:06,440 Oops, that's not a triangle. 714 00:43:06,440 --> 00:43:07,470 How's that? 715 00:43:07,470 --> 00:43:10,320 Is that now a triangulation? 716 00:43:10,320 --> 00:43:14,380 So that's an unstructured triangular mesh. 717 00:43:14,380 --> 00:43:16,310 Its quality is not too bad. 718 00:43:16,310 --> 00:43:25,900 The angles, some angles are small but not very small. 719 00:43:25,900 --> 00:43:29,890 And they're not near-- That angle's getting a little big 720 00:43:29,890 --> 00:43:32,980 too, it's getting toward a 180 degrees which 721 00:43:32,980 --> 00:43:35,160 you have to stay away from. 722 00:43:35,160 --> 00:43:40,350 If it was a 180, the triangle would squash in. 723 00:43:40,350 --> 00:43:42,650 So it's a bit squashed, that one. 724 00:43:42,650 --> 00:43:44,290 This one's a little long and narrow. 725 00:43:44,290 --> 00:43:45,980 But not bad. 726 00:43:45,980 --> 00:43:50,430 And you need a mesh generator to generate a mesh like this. 727 00:43:50,430 --> 00:43:55,710 And I had a thesis student just a few years ago 728 00:43:55,710 --> 00:43:59,290 who wrote a nice mesh generator in MATLAB. 729 00:43:59,290 --> 00:44:01,490 So we get a mesh. 730 00:44:01,490 --> 00:44:04,170 OK. 731 00:44:04,170 --> 00:44:09,980 Now, do you remember the finite element idea? 732 00:44:09,980 --> 00:44:13,460 Well, first you have to use the weak form. 733 00:44:13,460 --> 00:44:17,750 Let's save the weak form for first thing Friday. 734 00:44:17,750 --> 00:44:20,410 The weak form of Laplace. 735 00:44:20,410 --> 00:44:22,980 I need the weak form of Laplace's equation. 736 00:44:22,980 --> 00:44:27,550 I'll just tell you what it is. 737 00:44:27,550 --> 00:44:30,540 We all have double integrals. 738 00:44:30,540 --> 00:44:32,050 Oh, Poisson. 739 00:44:32,050 --> 00:44:33,340 I'm making it Poisson. 740 00:44:33,340 --> 00:44:36,460 I want a right-hand side. 741 00:44:36,460 --> 00:44:41,020 Double integral, this will be du/dx. 742 00:44:41,020 --> 00:44:45,040 743 00:44:45,040 --> 00:44:47,910 d test function/dx. 744 00:44:47,910 --> 00:44:50,600 And now what's changed in 2-D, I'll 745 00:44:50,600 --> 00:44:57,260 also have a du/dy dv/dy, dxdy. 746 00:44:57,260 --> 00:44:58,980 That's what I'll get. 747 00:44:58,980 --> 00:45:00,920 And on the right-hand side I'll just 748 00:45:00,920 --> 00:45:07,490 have f, the load, times the test. dxdy. 749 00:45:07,490 --> 00:45:10,120 750 00:45:10,120 --> 00:45:13,090 Yeah I guess, I have to write that down because that's 751 00:45:13,090 --> 00:45:15,540 our starting point. 752 00:45:15,540 --> 00:45:18,030 Do you remember the situation, and of course that's 753 00:45:18,030 --> 00:45:24,570 on the exam this evening, is remembering about 754 00:45:24,570 --> 00:45:28,890 the weak form in 1-D. So in 2-D I 755 00:45:28,890 --> 00:45:32,750 expect to see x's and y's, my functions are functions 756 00:45:32,750 --> 00:45:34,230 of x and y. 757 00:45:34,230 --> 00:45:37,630 I have my, this is my solution. 758 00:45:37,630 --> 00:45:41,510 The v's are all possible test functions, 759 00:45:41,510 --> 00:45:47,430 and this hold for every-- This is like the virtual work. 760 00:45:47,430 --> 00:45:50,420 You could call it the equation of virtual work, if your 761 00:45:50,420 --> 00:45:53,150 were a little old-fashioned. 762 00:45:53,150 --> 00:45:55,840 Those v's are virtual displacements, 763 00:45:55,840 --> 00:45:57,150 they're test functions. 764 00:45:57,150 --> 00:45:59,350 That's what it looks like. 765 00:45:59,350 --> 00:46:04,390 I'll come back to that at the start of Friday. 766 00:46:04,390 --> 00:46:07,400 What's the finite element idea? 767 00:46:07,400 --> 00:46:10,540 Just as in 1-D, the finite element idea 768 00:46:10,540 --> 00:46:13,450 is choose some trial functions, right? 769 00:46:13,450 --> 00:46:15,850 Choose some trial functions. 770 00:46:15,850 --> 00:46:20,220 And our approximate guy is going to be some combination 771 00:46:20,220 --> 00:46:22,200 of these trial functions. 772 00:46:22,200 --> 00:46:25,150 Some coefficient U_1 times the first trial 773 00:46:25,150 --> 00:46:35,560 function plus so on, plus U_n times the n-th trial function. 774 00:46:35,560 --> 00:46:37,960 So this will be our-- And these will also 775 00:46:37,960 --> 00:46:39,600 be our test functions again. 776 00:46:39,600 --> 00:46:47,370 These will also be, the phis are also the V's. 777 00:46:47,370 --> 00:46:49,310 I'll get an equation. 778 00:46:49,310 --> 00:46:52,190 By using n tests, by using the weak form 779 00:46:52,190 --> 00:46:55,210 n times for these n functions. 780 00:46:55,210 --> 00:47:01,240 And so each equation comes-- V is one of the phis, 781 00:47:01,240 --> 00:47:03,590 U is this combination of phis. 782 00:47:03,590 --> 00:47:04,690 Plug it in. 783 00:47:04,690 --> 00:47:07,430 You get an equation. 784 00:47:07,430 --> 00:47:10,500 What do I got to do in three minutes, is 785 00:47:10,500 --> 00:47:13,310 speak about the most important point. 786 00:47:13,310 --> 00:47:14,490 The phis. 787 00:47:14,490 --> 00:47:17,360 Choosing the phis is what matters. 788 00:47:17,360 --> 00:47:20,900 That's what made finite elements win. 789 00:47:20,900 --> 00:47:26,160 The fact that I choose nice simple functions, which 790 00:47:26,160 --> 00:47:31,730 are polynomials, little easy polynomials on each element, 791 00:47:31,730 --> 00:47:33,590 on each triangle. 792 00:47:33,590 --> 00:47:35,680 And the ones I'm going to speak about today 793 00:47:35,680 --> 00:47:37,750 are the linear ones. 794 00:47:37,750 --> 00:47:39,580 They're like hat functions, right? 795 00:47:39,580 --> 00:47:43,070 But now we're in 2-D. They're going to be pyramids. 796 00:47:43,070 --> 00:47:48,220 So if I take, this is unknown number one. 797 00:47:48,220 --> 00:47:50,930 Unknown number one, it's got its hat function. 798 00:47:50,930 --> 00:47:52,250 Pyramid function, sorry. 799 00:47:52,250 --> 00:47:53,480 Pyramid function. 800 00:47:53,480 --> 00:47:56,440 So its pyramid function is a one there, right? 801 00:47:56,440 --> 00:48:01,740 The pyramid, top of the pyramid is over that point. 802 00:48:01,740 --> 00:48:06,650 And it goes down to zero so it's zero at all these points. 803 00:48:06,650 --> 00:48:08,810 Well, at all the other points. 804 00:48:08,810 --> 00:48:11,510 That's the one beauty of finite elements, 805 00:48:11,510 --> 00:48:18,190 is that then this U, this coefficient U_1 that we 806 00:48:18,190 --> 00:48:21,860 compute, will actually be our approximation at this point. 807 00:48:21,860 --> 00:48:25,330 Because all the others are zero at that point. 808 00:48:25,330 --> 00:48:27,840 So can you just, this is all you have 809 00:48:27,840 --> 00:48:32,500 to do in the last 60 seconds is visualize this function. 810 00:48:32,500 --> 00:48:33,250 Do you see it? 811 00:48:33,250 --> 00:48:35,700 Maybe tent would be better than pyramid? 812 00:48:35,700 --> 00:48:36,790 Either one. 813 00:48:36,790 --> 00:48:39,680 What's the base of the pyramid? 814 00:48:39,680 --> 00:48:42,980 The base of the pyramid, I'm thinking 815 00:48:42,980 --> 00:48:48,000 of the surface as a way to visualize this function. 816 00:48:48,000 --> 00:48:53,090 It's a function that's one here, it goes down to zero linearly. 817 00:48:53,090 --> 00:48:57,270 So these are linear triangular elements. 818 00:48:57,270 --> 00:48:59,720 What's the base of the pyramid? 819 00:48:59,720 --> 00:49:03,730 Just this, right? 820 00:49:03,730 --> 00:49:05,950 That's the base. 821 00:49:05,950 --> 00:49:09,970 Because over in these other triangles, 822 00:49:09,970 --> 00:49:11,720 nothing ever got off zero. 823 00:49:11,720 --> 00:49:13,030 Nothing got off the ground. 824 00:49:13,030 --> 00:49:15,070 It's zero, zero, zero at all three. 825 00:49:15,070 --> 00:49:18,420 If I know it at all three corners, I know it everywhere. 826 00:49:18,420 --> 00:49:22,030 For linear functions, it's just a piece of flat roof. 827 00:49:22,030 --> 00:49:23,030 Piece of flat roof. 828 00:49:23,030 --> 00:49:25,960 So I have, how many pieces have I got around this point? 829 00:49:25,960 --> 00:49:27,200 Oh, where is the point? 830 00:49:27,200 --> 00:49:32,880 I guess I've got one, two, three, four, five, six, is it? 831 00:49:32,880 --> 00:49:37,870 It's a six, it's a pyramid with six sloping faces sloping down 832 00:49:37,870 --> 00:49:41,630 to zero along the sides, right? 833 00:49:41,630 --> 00:49:47,480 So it's like a six-sided teepee, six-sided tent. 834 00:49:47,480 --> 00:49:53,340 And here are the, the rods that hold the tent up 835 00:49:53,340 --> 00:49:55,190 would be these six things. 836 00:49:55,190 --> 00:50:00,520 And then the six sides would be six flat pieces. 837 00:50:00,520 --> 00:50:07,420 If you would see what I've tried to draw there, that's phi_1. 838 00:50:07,420 --> 00:50:10,500 And you can imagine that when I've got that, 839 00:50:10,500 --> 00:50:14,070 I can take the x derivative and the y derivative. 840 00:50:14,070 --> 00:50:17,920 What will I know about the x derivative and the y derivative 841 00:50:17,920 --> 00:50:20,120 in a typical triangle? 842 00:50:20,120 --> 00:50:26,000 If my function is in a typical triangle, say in this triangle, 843 00:50:26,000 --> 00:50:28,510 my function looks like a+bx+cy. 844 00:50:28,510 --> 00:50:31,970 845 00:50:31,970 --> 00:50:34,550 a+bx-- it's flat. 846 00:50:34,550 --> 00:50:35,760 It's linear. 847 00:50:35,760 --> 00:50:39,330 And these three numbers, a and b, are decided by the fact 848 00:50:39,330 --> 00:50:42,520 that the function should be one there, zero there, and zero 849 00:50:42,520 --> 00:50:43,590 there. 850 00:50:43,590 --> 00:50:45,540 Three facts about the function, three 851 00:50:45,540 --> 00:50:49,240 coefficients to match those facts. 852 00:50:49,240 --> 00:50:54,220 And what's the deal on the x derivative? 853 00:50:54,220 --> 00:50:54,910 It's just b. 854 00:50:54,910 --> 00:50:56,470 It's a constant. 855 00:50:56,470 --> 00:50:58,910 The y derivative is just c, a constant. 856 00:50:58,910 --> 00:51:04,470 So the integrals are easy and the the whole finite element 857 00:51:04,470 --> 00:51:08,070 system just goes smoothly. 858 00:51:08,070 --> 00:51:12,280 So then what the finite element system has to do, 859 00:51:12,280 --> 00:51:14,260 and we'll talk about it Friday, is 860 00:51:14,260 --> 00:51:17,460 gotta keep track of which triangles go to which nodes. 861 00:51:17,460 --> 00:51:20,760 How do you assemble, where do these pieces go in? 862 00:51:20,760 --> 00:51:26,560 But every finite-- every element matrix is going to be simple. 863 00:51:26,560 --> 00:51:27,810 OK.