1 00:00:00,000 --> 00:00:00,500 2 00:00:00,500 --> 00:00:02,944 The following content is provided under a Creative 3 00:00:02,944 --> 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,340 continue to offer high quality educational resources for free. 6 00:00:09,340 --> 00:00:12,530 To make a donation, or to view additional materials 7 00:00:12,530 --> 00:00:16,150 from hundreds of MIT courses, visit MIT OpenCourseWare 8 00:00:16,150 --> 00:00:20,780 at ocw.mit.edu. 9 00:00:20,780 --> 00:00:22,390 PROFESSOR STRANG: So. 10 00:00:22,390 --> 00:00:27,600 I got the preparation for finite elements. 11 00:00:27,600 --> 00:00:30,060 Again we're in one dimension, because that's 12 00:00:30,060 --> 00:00:35,620 where you can see first and most clearly how the system works. 13 00:00:35,620 --> 00:00:40,120 So the system was, really, to begin with the weak form 14 00:00:40,120 --> 00:00:43,020 that I introduced last time. 15 00:00:43,020 --> 00:00:45,780 The Galerkin idea that I introduced just 16 00:00:45,780 --> 00:00:48,940 at the very end of last time, and that idea 17 00:00:48,940 --> 00:00:54,250 is that instead of the continuous differential 18 00:00:54,250 --> 00:00:56,640 equations where-- Galerkin's idea 19 00:00:56,640 --> 00:00:59,230 is how do you make it discrete, and he'll 20 00:00:59,230 --> 00:01:02,240 choose some trial functions. 21 00:01:02,240 --> 00:01:03,490 Those are functions. 22 00:01:03,490 --> 00:01:05,870 And some test function. 23 00:01:05,870 --> 00:01:07,980 And I didn't get to say, but I'll say now, 24 00:01:07,980 --> 00:01:10,450 very often they're the same. 25 00:01:10,450 --> 00:01:15,820 So very often the phis are the same as the V's. 26 00:01:15,820 --> 00:01:20,970 And probably they will be in all my examples today. 27 00:01:20,970 --> 00:01:28,770 And then what's new today is, what choices would you make? 28 00:01:28,770 --> 00:01:34,230 You have pretty wide choice, but there are some natural ones 29 00:01:34,230 --> 00:01:35,420 to start with. 30 00:01:35,420 --> 00:01:38,460 And so that's where we are today. 31 00:01:38,460 --> 00:01:42,070 And then also the other part of today 32 00:01:42,070 --> 00:01:48,240 is how do we get from all that preparation to the equations 33 00:01:48,240 --> 00:01:49,830 that we actually solve. 34 00:01:49,830 --> 00:01:52,430 The KU=F, where does the K come from, 35 00:01:52,430 --> 00:01:54,100 where does the F come from? 36 00:01:54,100 --> 00:01:56,950 The F is going to come, of course, somehow 37 00:01:56,950 --> 00:01:59,060 from this right-hand side and the K 38 00:01:59,060 --> 00:02:01,220 is going to come from the left side. 39 00:02:01,220 --> 00:02:05,210 OK, so that's the overall direction 40 00:02:05,210 --> 00:02:08,240 if you want to know how finite elements work, 41 00:02:08,240 --> 00:02:10,320 that's the key line there. 42 00:02:10,320 --> 00:02:14,640 And then here I've recalled what the step was, here's 43 00:02:14,640 --> 00:02:16,350 our differential equation. 44 00:02:16,350 --> 00:02:17,800 And there's its weak form. 45 00:02:17,800 --> 00:02:19,020 This is the weak form. 46 00:02:19,020 --> 00:02:22,130 And let me put this in. 47 00:02:22,130 --> 00:02:24,940 Here I've reproduced what we reached 48 00:02:24,940 --> 00:02:30,260 last time, the weak form. 49 00:02:30,260 --> 00:02:34,160 That was the strong form with its boundary conditions; 50 00:02:34,160 --> 00:02:37,900 now we get the weak form with its boundary conditions. 51 00:02:37,900 --> 00:02:42,390 And the weak form involves u, so it's 52 00:02:42,390 --> 00:02:47,200 the boundary conditions on u, the fixed ones, 53 00:02:47,200 --> 00:02:51,530 that get used in the weak form. 54 00:02:51,530 --> 00:02:55,350 The free ones don't appear in the weak form, 55 00:02:55,350 --> 00:03:02,540 but by the magic of integration by parts, 56 00:03:02,540 --> 00:03:06,960 the free ones will sort of come out in a natural way. 57 00:03:06,960 --> 00:03:10,820 But we have to build in the essential, Dirichlet boundary 58 00:03:10,820 --> 00:03:15,640 conditions like that fixed right-hand end. 59 00:03:15,640 --> 00:03:22,620 OK, and because I think of v as a little movement away from u, 60 00:03:22,620 --> 00:03:26,420 but my u's are all fixed at the end, 61 00:03:26,420 --> 00:03:29,530 therefore v has to be fixed, too. 62 00:03:29,530 --> 00:03:35,540 OK, so this is important. 63 00:03:35,540 --> 00:03:38,320 But we haven't made it down to Earth yet. 64 00:03:38,320 --> 00:03:45,260 We were doing a lot of ideas last time, 65 00:03:45,260 --> 00:03:47,830 which are the center of things, but now let's 66 00:03:47,830 --> 00:03:49,450 get down to Earth. 67 00:03:49,450 --> 00:03:54,950 And down to Earth really means, what functions do we choose? 68 00:03:54,950 --> 00:03:57,040 And then how do we get the equation. 69 00:03:57,040 --> 00:04:01,240 So that's the job today, the principal job and this 70 00:04:01,240 --> 00:04:04,040 is of course what you would actually 71 00:04:04,040 --> 00:04:08,490 code up to run a finite element simulation. 72 00:04:08,490 --> 00:04:10,830 You would make a decision on these functions. 73 00:04:10,830 --> 00:04:15,170 And let's start with piecewise linear functions. 74 00:04:15,170 --> 00:04:22,070 So a typical phi is maybe centered at a node, 75 00:04:22,070 --> 00:04:25,150 so it goes up and down. 76 00:04:25,150 --> 00:04:33,450 So if that's node two, let's number these nodes: 77 00:04:33,450 --> 00:04:40,520 one, two, three, four, and five. 78 00:04:40,520 --> 00:04:44,600 Well, that's five there but I'm going to have, let's see. 79 00:04:44,600 --> 00:04:46,850 What do I have here? 80 00:04:46,850 --> 00:04:52,640 At a typical node, two, my function 81 00:04:52,640 --> 00:04:59,670 is zero except in the intervals that touch node two. 82 00:04:59,670 --> 00:05:02,140 So here's phi_2. 83 00:05:02,140 --> 00:05:03,530 phi_2(x). 84 00:05:03,530 --> 00:05:04,295 That's its graph. 85 00:05:04,295 --> 00:05:07,500 It comes along, it's piecewise linear up, 86 00:05:07,500 --> 00:05:12,010 it's piecewise linear back down, and it's zero again. 87 00:05:12,010 --> 00:05:13,310 So that would be phi_2. 88 00:05:13,310 --> 00:05:15,190 Then phi_1, there'll be a phi_1. 89 00:05:15,190 --> 00:05:18,410 90 00:05:18,410 --> 00:05:20,740 Like so, exactly similar. 91 00:05:20,740 --> 00:05:24,640 The whole point is keep the system simple. 92 00:05:24,640 --> 00:05:29,330 That's what the finite element idea is. 93 00:05:29,330 --> 00:05:32,110 Use simple functions for the phis. 94 00:05:32,110 --> 00:05:34,390 And I'm taking them also to be the test 95 00:05:34,390 --> 00:05:36,510 function v. Keep those simple. 96 00:05:36,510 --> 00:05:40,850 Now, what about at the boundaries? 97 00:05:40,850 --> 00:05:44,350 OK, well we've said our functions have to be, 98 00:05:44,350 --> 00:05:46,390 I'm doing free-fixed. 99 00:05:46,390 --> 00:05:54,890 So fixed comes to zero there and all my functions will do that. 100 00:05:54,890 --> 00:05:58,180 But this end is free, so watch this. 101 00:05:58,180 --> 00:06:02,910 This is another, what I'll call a half-hat. 102 00:06:02,910 --> 00:06:05,970 If I call those hat functions is that OK? 103 00:06:05,970 --> 00:06:08,270 It makes a nice short word. 104 00:06:08,270 --> 00:06:13,060 So these are hat functions. 105 00:06:13,060 --> 00:06:16,600 And then a fuller description would be piecewise linear, 106 00:06:16,600 --> 00:06:20,190 but hat functions is clear. 107 00:06:20,190 --> 00:06:23,770 OK, now notice I'm sticking in here what I maybe 108 00:06:23,770 --> 00:06:26,690 could call a half-hat. 109 00:06:26,690 --> 00:06:30,050 Because my V's and my phis, my functions 110 00:06:30,050 --> 00:06:33,510 are not constrained at that left-hand end. 111 00:06:33,510 --> 00:06:34,810 That's free. 112 00:06:34,810 --> 00:06:39,610 So there's a phi_1, and there's a phi_0. 113 00:06:39,610 --> 00:06:43,120 And a phi_3, and a phi_4. 114 00:06:43,120 --> 00:06:47,020 So altogether, I'm going to have five. 115 00:06:47,020 --> 00:06:49,340 And I've started the numbering at zero, 116 00:06:49,340 --> 00:06:50,600 I guess it just happens. 117 00:06:50,600 --> 00:06:52,600 So let's accept that. 118 00:06:52,600 --> 00:06:56,670 So I'm going to have five functions. 119 00:06:56,670 --> 00:07:00,560 And they will also be my five test functions. 120 00:07:00,560 --> 00:07:04,570 So let me first think of them as the trial functions. 121 00:07:04,570 --> 00:07:05,070 Phi. 122 00:07:05,070 --> 00:07:07,460 So what was the point about trial functions? 123 00:07:07,460 --> 00:07:12,160 The point about is, my approximate, my finite element 124 00:07:12,160 --> 00:07:18,170 solution U(x) is going to be a combination of those. 125 00:07:18,170 --> 00:07:22,440 Some U_0, times the phi_0 function, 126 00:07:22,440 --> 00:07:29,887 up to U_4 times the phi_4 function. 127 00:07:29,887 --> 00:07:30,970 And these are my unknowns. 128 00:07:30,970 --> 00:07:33,830 U_0, U_1, those numbers. 129 00:07:33,830 --> 00:07:35,980 I have five unknowns. 130 00:07:35,980 --> 00:07:38,030 And I'm using hat functions. 131 00:07:38,030 --> 00:07:45,240 So I should, really, why don't I draw a graph of U(x). 132 00:07:45,240 --> 00:07:48,910 So I don't need the words piecewise linear. 133 00:07:48,910 --> 00:07:53,870 You see, I have a kind of space of functions. 134 00:07:53,870 --> 00:08:01,080 My functions are all, my approximations 135 00:08:01,080 --> 00:08:05,080 are combinations of these fixed basis functions. 136 00:08:05,080 --> 00:08:11,530 You could call these phis, trial functions, basis functions, 137 00:08:11,530 --> 00:08:14,100 you're always choosing, in applied math, 138 00:08:14,100 --> 00:08:19,880 a bunch of functions whose combinations are going to be, 139 00:08:19,880 --> 00:08:21,660 is what you're going to work with. 140 00:08:21,660 --> 00:08:24,500 And here I'm making them hat functions. 141 00:08:24,500 --> 00:08:29,160 OK, so what does a combination of those guys look like? 142 00:08:29,160 --> 00:08:31,310 I'll even erase the word hat functions; 143 00:08:31,310 --> 00:08:32,860 we won't forget that. 144 00:08:32,860 --> 00:08:36,090 So what would a combination of-- Here's 145 00:08:36,090 --> 00:08:42,470 the same interval zero, one, with the same mesh, one, two, 146 00:08:42,470 --> 00:08:44,790 three, four guys inside. 147 00:08:44,790 --> 00:08:50,590 What would-- It just helps the visualization to see. 148 00:08:50,590 --> 00:08:57,360 If I combine these guys, so those were, despite the way 149 00:08:57,360 --> 00:08:59,920 it might look, that's one separate function. 150 00:08:59,920 --> 00:09:02,660 Two, three, four and five. 151 00:09:02,660 --> 00:09:06,860 And now suppose I take a combination. 152 00:09:06,860 --> 00:09:09,060 What kind of a function do I get? 153 00:09:09,060 --> 00:09:14,230 How would you describe this, a combination like this? 154 00:09:14,230 --> 00:09:15,710 Of those five guys? 155 00:09:15,710 --> 00:09:18,890 What will it look like? 156 00:09:18,890 --> 00:09:25,280 Between every node it will be a straight line, right? 157 00:09:25,280 --> 00:09:28,220 Because all these guys are straight, between those. 158 00:09:28,220 --> 00:09:31,010 So a typical function will start at what? 159 00:09:31,010 --> 00:09:36,880 This height will be U_0, because, well 160 00:09:36,880 --> 00:09:38,000 let me draw a few things. 161 00:09:38,000 --> 00:09:42,020 OK, so I'll put U_0 a little higher because I 162 00:09:42,020 --> 00:09:43,830 want to end up down at zero. 163 00:09:43,830 --> 00:09:49,140 So that might be the height U_0, and U_1 might be pretty close. 164 00:09:49,140 --> 00:09:51,820 U_2 might be coming down a bit. 165 00:09:51,820 --> 00:09:54,120 Coming down a bit, coming down a bit. 166 00:09:54,120 --> 00:09:55,850 And ending at zero. 167 00:09:55,850 --> 00:10:01,610 So those were meant to be corners. 168 00:10:01,610 --> 00:10:03,570 That wasn't a very good bit. 169 00:10:03,570 --> 00:10:05,750 There, OK. 170 00:10:05,750 --> 00:10:10,260 It wasn't meant to be, yeah. 171 00:10:10,260 --> 00:10:11,720 So that height is U_0. 172 00:10:11,720 --> 00:10:13,330 Now, notice why? 173 00:10:13,330 --> 00:10:15,210 Why is that? 174 00:10:15,210 --> 00:10:18,440 Why is the coefficient of phi_0 exactly 175 00:10:18,440 --> 00:10:24,210 the height, the displacement, at zero? 176 00:10:24,210 --> 00:10:29,490 Because all the other phis are zero. 177 00:10:29,490 --> 00:10:34,390 All the other phis are zero at this point. 178 00:10:34,390 --> 00:10:35,980 Only this guy's coming in. 179 00:10:35,980 --> 00:10:42,010 So we'll only see in this, at this point, 180 00:10:42,010 --> 00:10:45,130 see, even phi_1 has dropped to zero. 181 00:10:45,130 --> 00:10:48,640 So we're only going to see phi_0 times U_0. 182 00:10:48,640 --> 00:10:54,930 So, I should have said, we take all these heights to be one. 183 00:10:54,930 --> 00:10:56,380 Height is one. 184 00:10:56,380 --> 00:10:59,060 Course it doesn't matter because we're multiplying 185 00:10:59,060 --> 00:11:00,680 by u's, but so let's settle. 186 00:11:00,680 --> 00:11:02,540 They all have heights one. 187 00:11:02,540 --> 00:11:07,260 And this is sort of a key part of the finite element idea. 188 00:11:07,260 --> 00:11:11,910 You see, Galerkin, when he created 189 00:11:11,910 --> 00:11:14,470 just two or three functions phi, he 190 00:11:14,470 --> 00:11:17,700 tried to follow the exact solution. 191 00:11:17,700 --> 00:11:21,651 He had an idea in his mind what the solution to the problem 192 00:11:21,651 --> 00:11:22,150 will be. 193 00:11:22,150 --> 00:11:24,370 And he wanted to take two or three functions that 194 00:11:24,370 --> 00:11:26,200 would get him close to it. 195 00:11:26,200 --> 00:11:29,530 Here we choose the functions, they're 196 00:11:29,530 --> 00:11:32,470 in the finite element library before we even 197 00:11:32,470 --> 00:11:35,490 know what the equation is, or the boundary conditions. 198 00:11:35,490 --> 00:11:42,820 These functions are like, the hat function choice. 199 00:11:42,820 --> 00:11:48,810 And they have this beautiful sort of a connect to nodes. 200 00:11:48,810 --> 00:11:52,510 In a way where-- In fact, I got involved in finite elements 201 00:11:52,510 --> 00:11:55,370 in the first place just to understand 202 00:11:55,370 --> 00:11:57,700 what's the difference between finite elements 203 00:11:57,700 --> 00:12:00,470 and finite differences. 204 00:12:00,470 --> 00:12:03,340 Because the finite elements, as you'll see, 205 00:12:03,340 --> 00:12:07,130 are associated with nodes. phi_1 is the only guy 206 00:12:07,130 --> 00:12:09,660 that's not zero at node one. 207 00:12:09,660 --> 00:12:12,570 And therefore, what will this height be? 208 00:12:12,570 --> 00:12:14,440 What's that height? 209 00:12:14,440 --> 00:12:16,780 So that maybe comes down a little. 210 00:12:16,780 --> 00:12:18,530 What's this height? 211 00:12:18,530 --> 00:12:19,720 U_1. 212 00:12:19,720 --> 00:12:24,000 It's the coefficient of phi_1, because phi_1 is sitting there. 213 00:12:24,000 --> 00:12:26,320 And all the other phis are zero there, 214 00:12:26,320 --> 00:12:28,650 so this height is really U_1. 215 00:12:28,650 --> 00:12:33,860 And U_2, and U_3, and U_4, and U_5 is zero. 216 00:12:33,860 --> 00:12:41,410 So that was U_1, U_2, and so on. 217 00:12:41,410 --> 00:12:44,070 What I'm saying is, and we'll see it happen, 218 00:12:44,070 --> 00:12:49,530 is that this KU=F equation that we finally get to is going 219 00:12:49,530 --> 00:12:53,310 to look very like a finite difference equation. 220 00:12:53,310 --> 00:12:56,640 But it's coming from this different direction. 221 00:12:56,640 --> 00:13:04,640 And this way allows many more possibilities, 222 00:13:04,640 --> 00:13:09,170 gets things sort of more naturally right. 223 00:13:09,170 --> 00:13:13,060 It takes less-- With the finite difference equation, 224 00:13:13,060 --> 00:13:18,020 we had to go in there and decide what it should be. 225 00:13:18,020 --> 00:13:22,330 With finite elements, our decision is just the phis. 226 00:13:22,330 --> 00:13:24,750 Once we've decided the phis, Galerkin 227 00:13:24,750 --> 00:13:26,730 tells us what the equation is. 228 00:13:26,730 --> 00:13:31,430 And we'll get to the KU=F, what it is. 229 00:13:31,430 --> 00:13:38,300 But here I'm getting you to see what our approximate solution 230 00:13:38,300 --> 00:13:39,230 can look like. 231 00:13:39,230 --> 00:13:43,490 And this beautiful fact that the coefficients in here 232 00:13:43,490 --> 00:13:45,740 have a physical meaning. 233 00:13:45,740 --> 00:13:47,730 They're actually the displacements 234 00:13:47,730 --> 00:13:51,540 at the nodes for these simple functions. 235 00:13:51,540 --> 00:13:54,390 OK. 236 00:13:54,390 --> 00:13:56,710 You got a picture of what the trial functions are, 237 00:13:56,710 --> 00:14:02,930 some people would think about the functions as these guys. 238 00:14:02,930 --> 00:14:07,620 Other people might think of this picture, the combinations. 239 00:14:07,620 --> 00:14:11,290 So those are the individual basis functions. 240 00:14:11,290 --> 00:14:15,330 That's a typical combination of the typical one. 241 00:14:15,330 --> 00:14:21,750 OK, so we're looking for an equation for these U's. 242 00:14:21,750 --> 00:14:23,390 Five equations, of course. 243 00:14:23,390 --> 00:14:27,720 Because we've got five U's. 244 00:14:27,720 --> 00:14:30,520 So that's my final step here. 245 00:14:30,520 --> 00:14:33,420 What are the five equations for the five U's. 246 00:14:33,420 --> 00:14:38,410 And those are the equations that I'm going to call KU=F. OK. 247 00:14:38,410 --> 00:14:40,910 So here's now a critical moment. 248 00:14:40,910 --> 00:14:43,790 Where do the equations come from? 249 00:14:43,790 --> 00:14:47,830 Well, the equations come from the weak form. 250 00:14:47,830 --> 00:14:50,270 So I take the weak form. 251 00:14:50,270 --> 00:14:59,730 And in for u, for u here, I guess it's just there. 252 00:14:59,730 --> 00:15:00,540 I put this. 253 00:15:00,540 --> 00:15:05,320 I put capital U. So can I just copy, 254 00:15:05,320 --> 00:15:11,510 this is the weak form for before we've made it discrete. 255 00:15:11,510 --> 00:15:14,470 Before we've chosen n phis. 256 00:15:14,470 --> 00:15:16,980 OK, now let's choose the n phis, so now this'll 257 00:15:16,980 --> 00:15:18,360 be the weak form. 258 00:15:18,360 --> 00:15:27,170 Again, the weak form with Galerkin. 259 00:15:27,170 --> 00:15:28,764 After the decision. 260 00:15:28,764 --> 00:15:30,555 So it'll be the integral, from zero to one, 261 00:15:30,555 --> 00:15:33,290 of this c(x), whatever it is. 262 00:15:33,290 --> 00:15:39,810 Times the U(x)-- sorry, times the dU/dx, right? dU/dx, 263 00:15:39,810 --> 00:15:43,070 so what is dU/dx? 264 00:15:43,070 --> 00:15:46,300 Oh, you have to pay attention. 265 00:15:46,300 --> 00:15:47,870 This was a true solution. 266 00:15:47,870 --> 00:15:49,090 Little u. 267 00:15:49,090 --> 00:15:51,940 But now this is where I'm working. 268 00:15:51,940 --> 00:15:58,560 I'm working with capital U. So instead of the d little u dx, 269 00:15:58,560 --> 00:16:00,350 it's d capital U dx. 270 00:16:00,350 --> 00:16:03,580 Maybe I'll put it in there. d capital U dx. 271 00:16:03,580 --> 00:16:06,500 And then I'll put down here what it is. 272 00:16:06,500 --> 00:16:07,160 What is it? 273 00:16:07,160 --> 00:16:15,210 It's U_0*phi_0, can I use prime just to-- Or d phi_0/dx, 274 00:16:15,210 --> 00:16:18,620 whatever? 275 00:16:18,620 --> 00:16:20,740 Can I use prime for derivative? 276 00:16:20,740 --> 00:16:22,690 Just save a little space. 277 00:16:22,690 --> 00:16:25,980 So this is the derivative of my guy. 278 00:16:25,980 --> 00:16:32,010 U_1*phi_1'(x), up to whatever it was. 279 00:16:32,010 --> 00:16:33,190 U_4*phi_4'(x). 280 00:16:33,190 --> 00:16:37,180 281 00:16:37,180 --> 00:16:40,680 That's what that term is. 282 00:16:40,680 --> 00:16:43,750 And that multiplies dv/dx. 283 00:16:43,750 --> 00:16:50,650 Where v is, here v is any test function. 284 00:16:50,650 --> 00:16:54,700 Any test function, only required to have v(1)=0. 285 00:16:54,700 --> 00:17:00,010 But now, I'm going discrete. 286 00:17:00,010 --> 00:17:06,260 So instead of any test function, I'll use these five functions. 287 00:17:06,260 --> 00:17:08,110 So I've got five functions. 288 00:17:08,110 --> 00:17:11,660 The phis are the same as the V's, then. 289 00:17:11,660 --> 00:17:15,420 V_1, V_2, V_3 and V_4. 290 00:17:15,420 --> 00:17:17,230 Same guys. 291 00:17:17,230 --> 00:17:24,570 So now I'll put in dV, can I say dV_i/dx? 292 00:17:24,570 --> 00:17:27,830 293 00:17:27,830 --> 00:17:31,825 And on the right hand side I have the integral from zero 294 00:17:31,825 --> 00:17:47,450 to one of f(x)*V_i(x)dx, i is zero, one, two, three, or four. 295 00:17:47,450 --> 00:17:50,690 I'm testing against five V's. 296 00:17:50,690 --> 00:17:55,630 So I have this equation for five different V's. 297 00:17:55,630 --> 00:17:57,770 So i equals zero, one, two, three, four, 298 00:17:57,770 --> 00:18:00,050 gives me my five equations. 299 00:18:00,050 --> 00:18:02,350 Here are my five unknowns. 300 00:18:02,350 --> 00:18:05,500 This is my five by five system. 301 00:18:05,500 --> 00:18:08,950 Let me just step back a minute so you see what happened there. 302 00:18:08,950 --> 00:18:11,420 So what do you have to do? 303 00:18:11,420 --> 00:18:19,120 You chose the basis functions, the phis and the V's. 304 00:18:19,120 --> 00:18:23,550 Then you just plug into the weak form, you plug in dU/dx, 305 00:18:23,550 --> 00:18:25,350 is coming from there. 306 00:18:25,350 --> 00:18:27,360 So this is dU/dx. 307 00:18:27,360 --> 00:18:31,980 You have to plug dV/dx, you have to do the integrals. 308 00:18:31,980 --> 00:18:33,480 You have to do the integrals, that's 309 00:18:33,480 --> 00:18:36,420 something we didn't have in finite differences. 310 00:18:36,420 --> 00:18:39,530 Finite elements involves doing the integrals, left side 311 00:18:39,530 --> 00:18:42,880 and right-hand side. 312 00:18:42,880 --> 00:18:48,570 OK, so, and here we have five different integrals to do. 313 00:18:48,570 --> 00:18:53,710 We have f(x) times each V. This will be, 314 00:18:53,710 --> 00:18:57,770 this number will be F_i. 315 00:18:57,770 --> 00:19:06,890 So my F vector is going to be an F_0, F_1, down to F_4. 316 00:19:06,890 --> 00:19:10,830 The five guys that I get from these five integrals. 317 00:19:10,830 --> 00:19:13,700 Alright. 318 00:19:13,700 --> 00:19:17,570 And the K matrix is sitting here somewhere. 319 00:19:17,570 --> 00:19:19,800 That's the last thing, that's the final thing, 320 00:19:19,800 --> 00:19:23,070 is to see what is the K matrix. 321 00:19:23,070 --> 00:19:24,510 Which is coming. 322 00:19:24,510 --> 00:19:28,840 This is somehow K's times U's are sitting here. 323 00:19:28,840 --> 00:19:30,340 F's are sitting over there. 324 00:19:30,340 --> 00:19:33,500 So it may be good to see the F's first. 325 00:19:33,500 --> 00:19:34,740 So do you see this now? 326 00:19:34,740 --> 00:19:38,840 We made the choices, then what's our job? 327 00:19:38,840 --> 00:19:44,250 Our next job is to do all the integrations. 328 00:19:44,250 --> 00:19:47,380 Integrate my function against V. 329 00:19:47,380 --> 00:19:52,840 Let's make the natural first example, let f be one. 330 00:19:52,840 --> 00:19:56,220 First example, let f be one. 331 00:19:56,220 --> 00:19:57,360 All right. 332 00:19:57,360 --> 00:20:08,670 So if f is one, I'm going to find the system KU=F. 333 00:20:08,670 --> 00:20:15,140 So if I know f(x) is one, then I have everything I need to find 334 00:20:15,140 --> 00:20:16,830 these numbers. 335 00:20:16,830 --> 00:20:23,800 OK, actually we can probably do those by, 336 00:20:23,800 --> 00:20:26,500 you can probably tell me what they are. 337 00:20:26,500 --> 00:20:30,400 If f(x) is one, now. 338 00:20:30,400 --> 00:20:33,910 So this is example one. f(x) is a constant. 339 00:20:33,910 --> 00:20:37,110 One we have solved before. 340 00:20:37,110 --> 00:20:41,260 What's the integral of V_0? 341 00:20:41,260 --> 00:20:43,390 Right, that's what I have to do. 342 00:20:43,390 --> 00:20:46,790 What's the integral of this, f(x) being one, 343 00:20:46,790 --> 00:20:49,800 I'm just asking, I just have V_0(x)? 344 00:20:49,800 --> 00:20:54,640 The integral of V_0(x), and let me again draw V_0, 345 00:20:54,640 --> 00:20:56,010 which is phi_0. 346 00:20:56,010 --> 00:21:01,230 It's a half hat and then it goes along at zero. 347 00:21:01,230 --> 00:21:04,060 What's the integral of that function? 348 00:21:04,060 --> 00:21:06,600 One, yeah. 349 00:21:06,600 --> 00:21:08,710 How do I think about that integral? 350 00:21:08,710 --> 00:21:10,750 It's the area of the triangle. 351 00:21:10,750 --> 00:21:11,480 It's the area. 352 00:21:11,480 --> 00:21:13,460 That's what an integral is, it's the area. 353 00:21:13,460 --> 00:21:20,670 So the area is, I've got delta x there. 354 00:21:20,670 --> 00:21:22,750 Right, delta x as the base. 355 00:21:22,750 --> 00:21:26,870 One as the height, and you see the formula 356 00:21:26,870 --> 00:21:31,880 for the area of a triangle, it's got a half in there somewhere, 357 00:21:31,880 --> 00:21:32,580 right? 358 00:21:32,580 --> 00:21:33,390 A half. 359 00:21:33,390 --> 00:21:36,950 OK, can I factor out the delta x? 360 00:21:36,950 --> 00:21:38,860 Because the delta x is going to come in. 361 00:21:38,860 --> 00:21:41,380 I think there's a half there. 362 00:21:41,380 --> 00:21:43,940 And then what about F_1? 363 00:21:43,940 --> 00:21:51,740 What's the integral of this times V_1(x), the next V? 364 00:21:51,740 --> 00:21:56,900 It's the area under this dashed function. 365 00:21:56,900 --> 00:22:00,960 Which is now the basis 2 delta x, so I get a one. 366 00:22:00,960 --> 00:22:02,260 Is that right? 367 00:22:02,260 --> 00:22:06,450 I get a one, one, one, one. 368 00:22:06,450 --> 00:22:10,570 OK, so that was obviously not too tough, right? 369 00:22:10,570 --> 00:22:17,090 That was straightforward and notice something. 370 00:22:17,090 --> 00:22:20,640 Even here, in fact, we see it here. 371 00:22:20,640 --> 00:22:24,980 I don't know if you remember about that half. 372 00:22:24,980 --> 00:22:29,110 Do you remember something about when we did finite differences 373 00:22:29,110 --> 00:22:33,970 and we had a free boundary? 374 00:22:33,970 --> 00:22:37,810 And we lost an order of accuracy if we didn't do it right? 375 00:22:37,810 --> 00:22:40,030 Do you remember that? 376 00:22:40,030 --> 00:22:42,120 At the fixed boundary we were fine, 377 00:22:42,120 --> 00:22:45,570 but with finite differences at a free boundary, 378 00:22:45,570 --> 00:22:49,170 where I was using the matrix T. With one, 379 00:22:49,170 --> 00:22:55,650 minus one at the top row, I lost an order of accuracy. 380 00:22:55,650 --> 00:22:59,670 Unless I made some change on the right-hand side. 381 00:22:59,670 --> 00:23:01,350 Look what's happening. 382 00:23:01,350 --> 00:23:04,790 The finite element method is making the change for me 383 00:23:04,790 --> 00:23:06,340 on the right hand side. 384 00:23:06,340 --> 00:23:11,250 So the finite element method is going to automatically keep 385 00:23:11,250 --> 00:23:13,420 the second order accuracy. 386 00:23:13,420 --> 00:23:15,840 Keep the second order accuracy. 387 00:23:15,840 --> 00:23:18,030 So that's a key point. 388 00:23:18,030 --> 00:23:22,050 That these piecewise linear functions 389 00:23:22,050 --> 00:23:27,310 are associated with second order accuracy. 390 00:23:27,310 --> 00:23:29,950 Later we'll move up to parabolas, 391 00:23:29,950 --> 00:23:33,660 to cubics; that will move up the order of accuracy 392 00:23:33,660 --> 00:23:35,380 in a nice way. 393 00:23:35,380 --> 00:23:37,950 Where with finite differences we would have 394 00:23:37,950 --> 00:23:42,620 had to create new finite difference formulas. 395 00:23:42,620 --> 00:23:46,370 Our minus one, two, minus one formula, 396 00:23:46,370 --> 00:23:49,350 that was good for second order accuracy. 397 00:23:49,350 --> 00:23:51,990 Then we would have to figure out, 398 00:23:51,990 --> 00:23:54,010 in the quiz had partly started it, 399 00:23:54,010 --> 00:23:57,820 what if there's a c(x) in there, what do you do? 400 00:23:57,820 --> 00:24:00,230 Finite differences, there's more thinking involved. 401 00:24:00,230 --> 00:24:04,090 Finite elements is like just press the button. 402 00:24:04,090 --> 00:24:07,410 Well, there's a little more to it than that of course, 403 00:24:07,410 --> 00:24:09,520 because it's taking a full lecture. 404 00:24:09,520 --> 00:24:17,930 But in the end it's more systematic, you could say. 405 00:24:17,930 --> 00:24:22,390 So that's the F. Now are you ready for the K? 406 00:24:22,390 --> 00:24:24,590 So this is the key part, OK? 407 00:24:24,590 --> 00:24:30,620 So you have to can get this thing to simplify. 408 00:24:30,620 --> 00:24:33,820 So what am I looking for here? 409 00:24:33,820 --> 00:24:39,050 This whole left-hand side should be K times U. 410 00:24:39,050 --> 00:24:45,520 So I'm looking to see what multiplies-- I'm looking 411 00:24:45,520 --> 00:24:46,700 to make sense out of this. 412 00:24:46,700 --> 00:24:48,740 What's the first equation? 413 00:24:48,740 --> 00:24:52,910 Right, so the first equation or the zeroth equation, I guess. 414 00:24:52,910 --> 00:24:54,540 The zeroth equation, the one that'll 415 00:24:54,540 --> 00:24:58,730 run along and have this right-hand side, 416 00:24:58,730 --> 00:25:05,770 the zeroth equation is the equation when i is zero. 417 00:25:05,770 --> 00:25:09,250 It's the equation that comes from testing 418 00:25:09,250 --> 00:25:13,510 our weak form for V_0. 419 00:25:13,510 --> 00:25:17,200 For that particular form. 420 00:25:17,200 --> 00:25:21,260 Maybe I'll just start over on this board. 421 00:25:21,260 --> 00:25:23,750 Then I can write a formula, but I'd rather you 422 00:25:23,750 --> 00:25:26,120 see how it comes. 423 00:25:26,120 --> 00:25:31,680 So I'm looking at equation zero. 424 00:25:31,680 --> 00:25:34,040 So take i=0. 425 00:25:34,040 --> 00:25:36,630 426 00:25:36,630 --> 00:25:41,350 So I have my left side is my integral, of c(x). 427 00:25:41,350 --> 00:25:46,150 Times this combination that I wrote, U_0*phi_0' plus... 428 00:25:46,150 --> 00:25:48,770 429 00:25:48,770 --> 00:25:59,240 U_4*phi_4', times dV_0/dx*dx equal, 430 00:25:59,240 --> 00:26:03,020 and on the right side is where I got the F_0, 431 00:26:03,020 --> 00:26:07,440 which I already figured out to be delta x times a half. 432 00:26:07,440 --> 00:26:10,890 It's the left side that I'm worrying about. 433 00:26:10,890 --> 00:26:14,100 OK, you see what's happening here? 434 00:26:14,100 --> 00:26:19,800 This is some matrix. 435 00:26:19,800 --> 00:26:23,960 Its zeroth row is what we're finding -- multiplying U_0, 436 00:26:23,960 --> 00:26:34,360 U_1, U_2, U_3, and U_4 -- equaling the F vector. 437 00:26:34,360 --> 00:26:37,590 I'm supposed to be getting the first row of the matrix, 438 00:26:37,590 --> 00:26:42,980 the top row of the matrix, from the top V. OK, 439 00:26:42,980 --> 00:26:44,440 so let's just do these. 440 00:26:44,440 --> 00:26:47,900 We've got integrals to do again. 441 00:26:47,900 --> 00:26:50,830 Alright, what is dV_0/dx? 442 00:26:50,830 --> 00:26:55,270 443 00:26:55,270 --> 00:26:56,100 Do you see? 444 00:26:56,100 --> 00:26:57,970 Let me just see? 445 00:26:57,970 --> 00:27:02,240 What number is going in here? 446 00:27:02,240 --> 00:27:03,810 What number is going in there? 447 00:27:03,810 --> 00:27:06,490 Yeah, if we see that we're golden. 448 00:27:06,490 --> 00:27:08,100 What number is going in there? 449 00:27:08,100 --> 00:27:15,920 That's the thing that multiplies U_0 in the first row that 450 00:27:15,920 --> 00:27:22,930 means I should use V_0, so this is the point, this is K_00. 451 00:27:22,930 --> 00:27:25,850 And what's its formula? 452 00:27:25,850 --> 00:27:28,060 You realize I'm starting the count at zero 453 00:27:28,060 --> 00:27:33,040 because all these counts-- So what is K_00? 454 00:27:33,040 --> 00:27:35,040 It's an integral. 455 00:27:35,040 --> 00:27:40,000 Of what? c(x), good. 456 00:27:40,000 --> 00:27:48,360 Times this guy, because it's multiplying, times this guy, 457 00:27:48,360 --> 00:27:52,530 V_0', dx. 458 00:27:52,530 --> 00:27:54,600 That's what you have to do. 459 00:27:54,600 --> 00:27:58,050 That's what you have to do. c(x) times 460 00:27:58,050 --> 00:28:03,450 phi', it's phi_0', that's what would sit there. 461 00:28:03,450 --> 00:28:11,720 And maybe, well, let's figure that one, shall we? 462 00:28:11,720 --> 00:28:15,300 I have to know c(x), right, that's part of the problem. 463 00:28:15,300 --> 00:28:18,230 What would you like me to choose for c(x)? 464 00:28:18,230 --> 00:28:18,730 One. 465 00:28:18,730 --> 00:28:20,890 Thank you. 466 00:28:20,890 --> 00:28:22,570 I'll choose one. 467 00:28:22,570 --> 00:28:24,940 Let this be one. 468 00:28:24,940 --> 00:28:26,900 Or I could make it capital C and you 469 00:28:26,900 --> 00:28:29,770 would see a capital C appearing everywhere, but let's make it 470 00:28:29,770 --> 00:28:30,410 one. 471 00:28:30,410 --> 00:28:32,270 So what are we doing now? 472 00:28:32,270 --> 00:28:33,230 What's our equation? 473 00:28:33,230 --> 00:28:37,050 Our right-hand side is one, our c(x) is one, 474 00:28:37,050 --> 00:28:41,500 our equation has reduced to -u''=1. 475 00:28:41,500 --> 00:28:44,260 The first equation in the course. 476 00:28:44,260 --> 00:28:50,360 So we're back to September the 3rd or whatever it was. 477 00:28:50,360 --> 00:28:54,830 But doing it now by finite elements. 478 00:28:54,830 --> 00:28:58,960 OK, so let c(x) be one and tell me what this integral is. 479 00:28:58,960 --> 00:29:03,790 So c(x) is now, we're taking-- In our problem, 480 00:29:03,790 --> 00:29:05,570 we're supposing it's one. 481 00:29:05,570 --> 00:29:11,700 Let me just say: Suppose it's function. 482 00:29:11,700 --> 00:29:20,230 Then we have lots of integrals to do involving that function. 483 00:29:20,230 --> 00:29:24,050 And we might not do them exactly, that would be alright. 484 00:29:24,050 --> 00:29:29,460 It's certainly totally OK to do the integrals approximately, 485 00:29:29,460 --> 00:29:33,140 because we're doing everything else approximately. 486 00:29:33,140 --> 00:29:35,910 So we just have to be sure that we do the integrals 487 00:29:35,910 --> 00:29:39,330 with sufficient accuracy so that we don't lose accuracy 488 00:29:39,330 --> 00:29:41,780 in the integrals. 489 00:29:41,780 --> 00:29:43,810 Of course, with a one we're going 490 00:29:43,810 --> 00:29:45,420 to do the integral exactly. 491 00:29:45,420 --> 00:29:48,550 But if c(x) was some variable function, 492 00:29:48,550 --> 00:29:50,320 I wouldn't have to do it exactly, 493 00:29:50,320 --> 00:29:52,940 I would just have to do it with enough accuracy 494 00:29:52,940 --> 00:29:57,010 so that I don't lose extra accuracy 495 00:29:57,010 --> 00:30:02,510 beyond what I'm losing in the whole Galerkin approximation. 496 00:30:02,510 --> 00:30:05,250 OK, ready for that number. 497 00:30:05,250 --> 00:30:11,490 What number comes out of that? phi_0', let's graph phi_0'. 498 00:30:11,490 --> 00:30:14,520 And of course it's the same as V_0', so can I 499 00:30:14,520 --> 00:30:16,850 put a little graph here? 500 00:30:16,850 --> 00:30:22,442 Here is zero to one, and I'm going to graph phi_0'. 501 00:30:22,442 --> 00:30:23,150 So what's phi_0'? 502 00:30:23,150 --> 00:30:26,230 503 00:30:26,230 --> 00:30:30,850 Oh, it's negative, isn't it? 504 00:30:30,850 --> 00:30:32,870 My little graph isn't going to work. 505 00:30:32,870 --> 00:30:35,390 I didn't leave enough room. 506 00:30:35,390 --> 00:30:39,319 It's negative. 507 00:30:39,319 --> 00:30:40,610 So I'll just write it in words. 508 00:30:40,610 --> 00:30:44,110 It's the same as V_0', and what is it? 509 00:30:44,110 --> 00:30:50,290 Tell me what it is, what's the derivative of that function? 510 00:30:50,290 --> 00:30:52,180 It's what? 511 00:30:52,180 --> 00:30:54,830 Negative one. 512 00:30:54,830 --> 00:30:57,300 Wait a minute. 513 00:30:57,300 --> 00:31:01,070 Yeah, it's going to have a certain value, yeah. 514 00:31:01,070 --> 00:31:04,640 You can tell me what it is beyond that point real fast. 515 00:31:04,640 --> 00:31:15,270 So it's something up to delta-- So what is the slope? 516 00:31:15,270 --> 00:31:20,140 What's that slope there, of phi_0? 517 00:31:20,140 --> 00:31:25,790 It's not negative one, because remember, what's the base here? 518 00:31:25,790 --> 00:31:30,610 That's not the point one, I'm sorry. 519 00:31:30,610 --> 00:31:36,590 All these were delta x's. 520 00:31:36,590 --> 00:31:38,790 Those were just numbering the nodes. 521 00:31:38,790 --> 00:31:43,200 But the actual length scale is the delta x scale. 522 00:31:43,200 --> 00:31:46,150 So now tell me what it is. 523 00:31:46,150 --> 00:31:52,280 The derivative is negative one over delta x, right? 524 00:31:52,280 --> 00:31:56,290 It dropped by one when it went across by delta x. 525 00:31:56,290 --> 00:32:02,690 And this is only up to node one. 526 00:32:02,690 --> 00:32:06,890 Up to delta x and then zero afterwards. 527 00:32:06,890 --> 00:32:09,050 This is a key point. 528 00:32:09,050 --> 00:32:14,450 That all our functions are local. 529 00:32:14,450 --> 00:32:16,800 Our functions are local. 530 00:32:16,800 --> 00:32:18,810 What does that mean? 531 00:32:18,810 --> 00:32:23,650 You can tell me what am I going to get when I integrate, 532 00:32:23,650 --> 00:32:28,160 for example, when later on I might be integrating 533 00:32:28,160 --> 00:32:31,250 phi_1' against V_4'. 534 00:32:31,250 --> 00:32:34,380 535 00:32:34,380 --> 00:32:37,240 What's the answer? 536 00:32:37,240 --> 00:32:39,130 This is the key point. 537 00:32:39,130 --> 00:32:43,060 Later, when I'm looking for the one, four entry, 538 00:32:43,060 --> 00:32:47,260 when I'm looking there, I'm going to do an integral 539 00:32:47,260 --> 00:32:49,760 of phi_1'. 540 00:32:49,760 --> 00:32:54,790 I'll erase for a moment and do this in my head. 541 00:32:54,790 --> 00:33:01,180 When I integrate phi_1' against V_4'. 542 00:33:01,180 --> 00:33:06,480 Maybe it's the fourth row. 543 00:33:06,480 --> 00:33:09,480 And the first guy over, maybe it's this guy I'm doing. 544 00:33:09,480 --> 00:33:11,950 Doesn't matter a whole lot. 545 00:33:11,950 --> 00:33:16,900 Because the answer is, when I integrate phi_1' 546 00:33:16,900 --> 00:33:22,500 against V_4' just, it's nice to get the easy ones. 547 00:33:22,500 --> 00:33:23,620 It's zero. 548 00:33:23,620 --> 00:33:26,460 Why is it zero? 549 00:33:26,460 --> 00:33:31,350 Why is the integral of phi_1' against V_4' zero? 550 00:33:31,350 --> 00:33:37,820 Because these phis are local. phi_1' is only non-zero here. 551 00:33:37,820 --> 00:33:41,240 V_4' is only non-zero over here. 552 00:33:41,240 --> 00:33:45,420 The two don't overlap. 553 00:33:45,420 --> 00:33:48,570 Anywhere the one is not zero, the other is zero. 554 00:33:48,570 --> 00:33:52,870 So that's a zero there. 555 00:33:52,870 --> 00:33:59,840 In fact, our overlaps, I'm just sort of looking ahead here. 556 00:33:59,840 --> 00:34:05,740 Our overlaps, a phi overlaps itself, of course. 557 00:34:05,740 --> 00:34:08,850 And its right-hand neighbor and its left-hand neighbor. 558 00:34:08,850 --> 00:34:13,070 But nobody two or three or more away. 559 00:34:13,070 --> 00:34:19,420 I think our K, all our integrals are going to be zero outside, 560 00:34:19,420 --> 00:34:21,540 we'll have another tri-diagonal matrix. 561 00:34:21,540 --> 00:34:24,700 We're going to have zeroes all here. 562 00:34:24,700 --> 00:34:36,610 And we'll only have entries of phi against V 563 00:34:36,610 --> 00:34:40,480 when they're either the same or just differ by one. 564 00:34:40,480 --> 00:34:45,340 So we'll only have three diagonals. 565 00:34:45,340 --> 00:34:48,430 OK, we were about to find out what that number is. 566 00:34:48,430 --> 00:34:53,170 So the slope of this is minus one over delta x, 567 00:34:53,170 --> 00:34:59,410 and that's-- I'm sorry, let me go back to zero, zero. 568 00:34:59,410 --> 00:35:02,460 OK. 569 00:35:02,460 --> 00:35:06,560 This is what we're keeping our fingers crossed for. 570 00:35:06,560 --> 00:35:09,810 What's that number? 571 00:35:09,810 --> 00:35:15,690 So I have this thing, actually is it just squared? 572 00:35:15,690 --> 00:35:17,320 And that's the slope. 573 00:35:17,320 --> 00:35:21,340 And then the phi and the V I'm choosing the same, 574 00:35:21,340 --> 00:35:23,520 so that's the slope again. 575 00:35:23,520 --> 00:35:26,070 I think I'm just getting one over delta 576 00:35:26,070 --> 00:35:30,610 x squared for that times that times the one. 577 00:35:30,610 --> 00:35:33,630 So what's K_00? 578 00:35:33,630 --> 00:35:35,100 One over delta x. 579 00:35:35,100 --> 00:35:37,940 Where'd the delta x come from? 580 00:35:37,940 --> 00:35:44,120 Because we're only integrating over, it looks like zero to one 581 00:35:44,120 --> 00:35:46,310 but they're all zero. 582 00:35:46,310 --> 00:35:49,070 We're really only integrating, the only reality 583 00:35:49,070 --> 00:35:51,750 was out to node one. 584 00:35:51,750 --> 00:35:53,500 Out to delta x. 585 00:35:53,500 --> 00:36:00,750 You see that the number there, the number here on the diagonal 586 00:36:00,750 --> 00:36:08,620 is one over delta x. 587 00:36:08,620 --> 00:36:14,340 OK, how about doing K_11 for me? 588 00:36:14,340 --> 00:36:17,570 So again, now these guys will be the same guys. 589 00:36:17,570 --> 00:36:19,320 It's a square. 590 00:36:19,320 --> 00:36:24,860 No it's the integral phi_1' against V_1', they're the same. 591 00:36:24,860 --> 00:36:32,090 And what is phi_1', which is the same as V_1'? 592 00:36:32,090 --> 00:36:35,430 What's the derivative now? 593 00:36:35,430 --> 00:36:39,730 It's, ah. 594 00:36:39,730 --> 00:36:42,650 What's the slope of this function? 595 00:36:42,650 --> 00:36:46,520 It goes up and goes back down, right? 596 00:36:46,520 --> 00:36:50,880 I have a plus part, so the slope going up 597 00:36:50,880 --> 00:36:53,280 is the one over delta x. 598 00:36:53,280 --> 00:36:57,250 And then the slope coming down is minus one over delta x. 599 00:36:57,250 --> 00:37:04,270 So this was up to delta x and then 600 00:37:04,270 --> 00:37:08,900 to two delta x, and then zero. 601 00:37:08,900 --> 00:37:11,590 That's a much more typical thing, 602 00:37:11,590 --> 00:37:14,110 the slope goes the function, the hat function 603 00:37:14,110 --> 00:37:16,450 goes up to the top of the hat. 604 00:37:16,450 --> 00:37:18,140 Back down. 605 00:37:18,140 --> 00:37:21,360 The slope up and the slope down are easy. 606 00:37:21,360 --> 00:37:23,680 And now the integral's easy. 607 00:37:23,680 --> 00:37:28,490 So I'm just squaring, well, when I square it, 608 00:37:28,490 --> 00:37:30,930 this squared is the one over delta x squared. 609 00:37:30,930 --> 00:37:34,280 This is the same, because the minus will get squared. 610 00:37:34,280 --> 00:37:37,320 So what's K_11? 611 00:37:37,320 --> 00:37:41,510 What's K_11 now? 612 00:37:41,510 --> 00:37:46,120 Have you got K_11 in your head? 613 00:37:46,120 --> 00:37:50,280 This is one over delta x squared. 614 00:37:50,280 --> 00:37:54,880 And now what is the integral? 615 00:37:54,880 --> 00:37:57,830 Two over delta x. 616 00:37:57,830 --> 00:38:04,160 Because now we're integrating from zero to two delta x, 617 00:38:04,160 --> 00:38:07,650 because that's where my functions are going out 618 00:38:07,650 --> 00:38:09,490 from zero to node two. 619 00:38:09,490 --> 00:38:12,110 If the function's numbered one. 620 00:38:12,110 --> 00:38:16,280 So it's two delta x times this; I 621 00:38:16,280 --> 00:38:22,670 think we get a two over delta x on that diagonal. 622 00:38:22,670 --> 00:38:28,040 Would you care to guess the rest of the diagonal? 623 00:38:28,040 --> 00:38:36,240 Yes, you tell me what's K_22 and K_33 and K_44? 624 00:38:36,240 --> 00:38:37,390 They're all the same. 625 00:38:37,390 --> 00:38:39,110 We're just shifting over. 626 00:38:39,110 --> 00:38:44,600 So two over delta x goes down there. 627 00:38:44,600 --> 00:38:47,050 Alright, one more to do. 628 00:38:47,050 --> 00:38:50,820 One more integral to do. 629 00:38:50,820 --> 00:38:53,000 This next guy. 630 00:38:53,000 --> 00:38:58,520 So can you tell me what do I get now for K_01? 631 00:38:58,520 --> 00:39:07,310 K_01, so now this is the case where I'm in row zero, 632 00:39:07,310 --> 00:39:12,690 so this should be V_0, because that tells me the row I'm in. 633 00:39:12,690 --> 00:39:13,340 But phi_1. 634 00:39:13,340 --> 00:39:17,900 635 00:39:17,900 --> 00:39:22,420 What happens when I integrate, just see the picture here. 636 00:39:22,420 --> 00:39:30,590 Let me just draw it small. phi_1', so let me draw phi_1. 637 00:39:30,590 --> 00:39:33,130 And V_0. 638 00:39:33,130 --> 00:39:35,720 OK. 639 00:39:35,720 --> 00:39:37,340 But it's the derivatives that I want. 640 00:39:37,340 --> 00:39:39,500 It's the slopes that I want, OK? 641 00:39:39,500 --> 00:39:45,250 So what do I get from here on out? 642 00:39:45,250 --> 00:39:48,580 Zero, because this guy only got to there. 643 00:39:48,580 --> 00:39:51,940 That's the half hat, the first guy stopped at delta x. 644 00:39:51,940 --> 00:39:55,020 So whatever is happening here is going to be multiplied by zero. 645 00:39:55,020 --> 00:39:57,460 So it's just here. 646 00:39:57,460 --> 00:40:04,520 One delta x interval for this one. 647 00:40:04,520 --> 00:40:07,450 They just overlap in one interval, of course. 648 00:40:07,450 --> 00:40:11,590 This guy and its neighbor only overlap in one interval. 649 00:40:11,590 --> 00:40:15,750 And what's the deal about the two slopes? 650 00:40:15,750 --> 00:40:17,240 They're opposite. 651 00:40:17,240 --> 00:40:20,170 One's coming down, one's going up. 652 00:40:20,170 --> 00:40:22,840 But the slopes are one over delta x 653 00:40:22,840 --> 00:40:24,510 and minus one over delta x. 654 00:40:24,510 --> 00:40:25,934 Do you see what's happening here? 655 00:40:25,934 --> 00:40:26,600 I'm integrating. 656 00:40:26,600 --> 00:40:30,000 Here I have a slope of one over delta x, 657 00:40:30,000 --> 00:40:33,990 and here I have a slope of minus one over delta x, 658 00:40:33,990 --> 00:40:35,730 so I should multiply those. 659 00:40:35,730 --> 00:40:41,950 Minus one over delta x squared, integrate, what goes in K_01? 660 00:40:41,950 --> 00:40:47,570 What's that number? 661 00:40:47,570 --> 00:40:54,270 It's that times that integrated, but now the integral 662 00:40:54,270 --> 00:40:56,305 is only going really out to delta 663 00:40:56,305 --> 00:41:01,400 x because basically I'm just stopping there. 664 00:41:01,400 --> 00:41:03,740 So-- But there's a minus now. 665 00:41:03,740 --> 00:41:05,410 Because it's not the square. 666 00:41:05,410 --> 00:41:07,950 It's this times its neighbor. 667 00:41:07,950 --> 00:41:10,790 One's going up, and one's going down. 668 00:41:10,790 --> 00:41:12,570 So it's delta x squared, and then 669 00:41:12,570 --> 00:41:23,610 the length of the interval, this is a minus one over delta x. 670 00:41:23,610 --> 00:41:28,700 Would you care to guess the rest of this matrix? 671 00:41:28,700 --> 00:41:31,500 What's the rest of that diagonal, 672 00:41:31,500 --> 00:41:34,900 above the main diagonal? 673 00:41:34,900 --> 00:41:36,930 It's all the same. 674 00:41:36,930 --> 00:41:43,760 That stays the same, because when I do phi_2*V_1, 675 00:41:43,760 --> 00:41:47,440 my picture is just like shifted over. 676 00:41:47,440 --> 00:41:50,400 But I still have one coming down, and one going up. 677 00:41:50,400 --> 00:41:53,610 When I do phi_3*V_2, same thing. 678 00:41:53,610 --> 00:42:00,210 And if I do phi_1*V_2, it'll be the same. 679 00:42:00,210 --> 00:42:02,910 I'm going to get this minus one over delta 680 00:42:02,910 --> 00:42:07,470 x all the way on that diagonal, also. 681 00:42:07,470 --> 00:42:08,660 Symmetry. 682 00:42:08,660 --> 00:42:10,990 It's going to come out symmetric. 683 00:42:10,990 --> 00:42:13,410 Actually, since the course started 684 00:42:13,410 --> 00:42:15,910 by speaking about properties of matrices, 685 00:42:15,910 --> 00:42:19,600 let me just say K is going to turn out to be 686 00:42:19,600 --> 00:42:21,510 symmetric positive definite. 687 00:42:21,510 --> 00:42:23,350 And what's more, for this example 688 00:42:23,350 --> 00:42:27,040 we recognize K completely. 689 00:42:27,040 --> 00:42:33,090 You will say: Why did you take so long to get to this result? 690 00:42:33,090 --> 00:42:40,840 K is the one over delta x part times, what's the matrix? 691 00:42:40,840 --> 00:42:47,480 It's T. It's T. So it's one, minus one, minus one, two, 692 00:42:47,480 --> 00:42:53,220 minus one, minus one, two, minus one, minus one, two, minus one, 693 00:42:53,220 --> 00:42:57,670 and I guess we had five of them. 694 00:42:57,670 --> 00:43:01,180 Oh, but nobody there, right? 695 00:43:01,180 --> 00:43:02,910 That's not there. 696 00:43:02,910 --> 00:43:06,480 That fixed-- Why do we not have a minus one? 697 00:43:06,480 --> 00:43:09,040 Because we've got no, there isn't a six. 698 00:43:09,040 --> 00:43:11,990 That would be column-- We've got one, two, three, four, 699 00:43:11,990 --> 00:43:17,130 five columns; there's no U_5, there's no V_5, 700 00:43:17,130 --> 00:43:20,190 we've got them all. 701 00:43:20,190 --> 00:43:27,760 And the F, so that-- So KU, this thing multiplies U_0 to U_4, 702 00:43:27,760 --> 00:43:33,330 to U_4, and it produces F, which is 703 00:43:33,330 --> 00:43:39,570 one over delta, which is what? 704 00:43:39,570 --> 00:43:44,900 Oh, delta x is in the numerator, right. 705 00:43:44,900 --> 00:43:53,790 Times a half, one, one, one and one. 706 00:43:53,790 --> 00:44:00,430 That is the finite element system KU=F. 707 00:44:00,430 --> 00:44:04,640 For this simple problem. 708 00:44:04,640 --> 00:44:06,880 It's exactly what finite differences did. 709 00:44:06,880 --> 00:44:11,180 So you can see why my first introduction to finite elements 710 00:44:11,180 --> 00:44:15,370 was with the question: what's the difference? 711 00:44:15,370 --> 00:44:18,330 The finite element community at that point, this 712 00:44:18,330 --> 00:44:23,230 was like the golden age of finite elements, 713 00:44:23,230 --> 00:44:26,430 all this was just beginning to be created. 714 00:44:26,430 --> 00:44:33,140 These elements were being used. 715 00:44:33,140 --> 00:44:36,440 Especially in civil and structural engineering, 716 00:44:36,440 --> 00:44:40,380 that's where a lot of the earliest papers came out of. 717 00:44:40,380 --> 00:44:45,260 And then, in a model problem it didn't look anything new. 718 00:44:45,260 --> 00:44:50,060 It looked like our original finite difference matrix. 719 00:44:50,060 --> 00:44:55,590 But there were some new things. 720 00:44:55,590 --> 00:44:59,320 First, there was this new 1/2, that we hadn't particularly 721 00:44:59,320 --> 00:45:02,150 noticed with finite differences. 722 00:45:02,150 --> 00:45:04,680 We, we could catch onto that. 723 00:45:04,680 --> 00:45:06,740 Here's a minor difference. 724 00:45:06,740 --> 00:45:09,390 You notice that the delta x is-- Strictly 725 00:45:09,390 --> 00:45:11,880 speaking the delta x is up here then, 726 00:45:11,880 --> 00:45:14,700 but when I divide by delta x then I'm 727 00:45:14,700 --> 00:45:16,990 back to the finite difference. 728 00:45:16,990 --> 00:45:19,340 I have the one over delta x squared, 729 00:45:19,340 --> 00:45:22,090 it looks like finite differences again. 730 00:45:22,090 --> 00:45:24,040 So everything looks the same. 731 00:45:24,040 --> 00:45:30,750 But, of course, if c(x) isn't one or if f(x) isn't one, 732 00:45:30,750 --> 00:45:31,380 oh yeah. 733 00:45:31,380 --> 00:45:37,230 If c(x) isn't one then I've got integrals to do. 734 00:45:37,230 --> 00:45:38,850 I would approximate those. 735 00:45:38,850 --> 00:45:41,150 And I could then come out with something that would 736 00:45:41,150 --> 00:45:43,360 look like a finite differences. 737 00:45:43,360 --> 00:45:46,910 Let me take our other favorite model problem. 738 00:45:46,910 --> 00:45:51,300 What would be the F if, yeah, here's a question. 739 00:45:51,300 --> 00:45:55,680 What would be the right side if my vector, 740 00:45:55,680 --> 00:46:00,480 instead of being one, what's my other favorite choice? 741 00:46:00,480 --> 00:46:03,030 Delta. 742 00:46:03,030 --> 00:46:08,770 So I take delta at x minus, let me take delta at x minus 1/4, 743 00:46:08,770 --> 00:46:10,070 first. 744 00:46:10,070 --> 00:46:12,330 Suppose that's my f. 745 00:46:12,330 --> 00:46:18,060 Then I've got to change all these guys. 746 00:46:18,060 --> 00:46:20,590 And what would they be? 747 00:46:20,590 --> 00:46:24,780 What would be the new right-hand side 748 00:46:24,780 --> 00:46:33,090 when I have this point load? 749 00:46:33,090 --> 00:46:35,840 I have to go back to the integrals, right? 750 00:46:35,840 --> 00:46:38,980 I have to go back to these guys. 751 00:46:38,980 --> 00:46:42,440 These integrals, with that new f, 752 00:46:42,440 --> 00:46:49,310 this is now delta of x minus a 1/4, times each V, times dx. 753 00:46:49,310 --> 00:46:52,200 I have to integrate delta of x minus 1/4 754 00:46:52,200 --> 00:46:54,460 against every hat function. 755 00:46:54,460 --> 00:46:56,560 And see what it equals? 756 00:46:56,560 --> 00:46:59,380 And what will I get? 757 00:46:59,380 --> 00:47:00,950 You're going to tell me right away. 758 00:47:00,950 --> 00:47:04,780 What are those integrals? 759 00:47:04,780 --> 00:47:08,730 That's a point load at node one. 760 00:47:08,730 --> 00:47:14,030 Times the V integrated over the whole thing. 761 00:47:14,030 --> 00:47:18,060 What do I get? 762 00:47:18,060 --> 00:47:21,270 I get a one, yeah. 763 00:47:21,270 --> 00:47:25,220 That integral is going to pick out the value at a quarter. 764 00:47:25,220 --> 00:47:27,100 Right, that's what the delta function does, 765 00:47:27,100 --> 00:47:29,020 the spike is at a quarter. 766 00:47:29,020 --> 00:47:33,690 Has area one, so it picks out the V_i at a quarter. 767 00:47:33,690 --> 00:47:37,150 V_i at a quarter will be? 768 00:47:37,150 --> 00:47:46,930 One for the-- I think we get a [0, 1, 0, 0, 0]. 769 00:47:46,930 --> 00:47:55,430 Again a little bit what our finite differences 770 00:47:55,430 --> 00:47:59,140 suggested that we should do. 771 00:47:59,140 --> 00:48:02,230 Alright, here's one final one for today. 772 00:48:02,230 --> 00:48:05,880 Suppose the delta function is not at a node. 773 00:48:05,880 --> 00:48:10,970 Suppose it's at 3/8. 774 00:48:10,970 --> 00:48:13,680 Or it could be at any point a, but let 775 00:48:13,680 --> 00:48:18,870 me just take a typical, a special one where I can do it. 776 00:48:18,870 --> 00:48:22,280 Suppose the load is at 3/8. 777 00:48:22,280 --> 00:48:27,000 What do I get for the integrals now? 778 00:48:27,000 --> 00:48:31,280 So now, it's delta of x minus 3/8. 779 00:48:31,280 --> 00:48:40,490 The spike is at this point here. 780 00:48:40,490 --> 00:48:44,420 That's where delta is now, spiking at 3/8. 781 00:48:44,420 --> 00:48:47,670 Is that right? 782 00:48:47,670 --> 00:48:51,380 We had 1/5, tell me what-- oh, I should have had 1/5 before, 783 00:48:51,380 --> 00:48:53,410 sorry. 784 00:48:53,410 --> 00:48:55,230 Change that on the videotape. 785 00:48:55,230 --> 00:48:59,800 All those 1/4s were-- That 1/4 was 1/5, 786 00:48:59,800 --> 00:49:01,600 and now what do I want? 787 00:49:01,600 --> 00:49:03,710 Three? 788 00:49:03,710 --> 00:49:07,070 I wanted to take a nice one that was halfway. 789 00:49:07,070 --> 00:49:09,180 I just forgot what halfway was. 790 00:49:09,180 --> 00:49:11,370 Where is halfway there? 791 00:49:11,370 --> 00:49:16,100 3/10 now for delta. 792 00:49:16,100 --> 00:49:19,850 So that was-- Before I had it for when delta. 793 00:49:19,850 --> 00:49:24,730 So previously was delta at x minus 1/5 794 00:49:24,730 --> 00:49:34,620 and now delta at x minus 3/10, what's the F now? 795 00:49:34,620 --> 00:49:35,690 What's the F now? 796 00:49:35,690 --> 00:49:39,810 So the spike is right in the middle between one and two. 797 00:49:39,810 --> 00:49:43,850 What's do those integrals come out to be? 798 00:49:43,850 --> 00:49:49,000 If I integrate delta function times the different hats, 799 00:49:49,000 --> 00:49:51,830 what do I get? 800 00:49:51,830 --> 00:49:52,980 What do I get, yeah. 801 00:49:52,980 --> 00:49:55,960 I get a zero for this first guy because it 802 00:49:55,960 --> 00:49:57,880 didn't touch the half hat. 803 00:49:57,880 --> 00:50:00,150 And then what do I get there? 804 00:50:00,150 --> 00:50:01,190 Half. 805 00:50:01,190 --> 00:50:03,480 And what do I get at the next one? 806 00:50:03,480 --> 00:50:04,750 Half again. 807 00:50:04,750 --> 00:50:07,630 And then the other guys it doesn't touch. 808 00:50:07,630 --> 00:50:09,970 You see, it automatically does it. 809 00:50:09,970 --> 00:50:11,980 Does those smart things. 810 00:50:11,980 --> 00:50:14,800 It automatically makes the smart choice. 811 00:50:14,800 --> 00:50:21,700 And if the spike was at a, at any point a, 812 00:50:21,700 --> 00:50:24,770 then at that typical point a wherever it is, 813 00:50:24,770 --> 00:50:27,830 like there, spike could be there. 814 00:50:27,830 --> 00:50:31,840 Then I would have, what would I have if the spike was there? 815 00:50:31,840 --> 00:50:36,840 I'd have a little bit of phi_3, and a big bit of phi_4. 816 00:50:36,840 --> 00:50:38,780 And the two parts would add to one. 817 00:50:38,780 --> 00:50:40,920 It would take the right proportion. 818 00:50:40,920 --> 00:50:47,080 It would be the proportion, by however much this spike was 819 00:50:47,080 --> 00:50:51,540 near there, it would give that extra weight to phi_4. 820 00:50:51,540 --> 00:50:54,870 OK. 821 00:50:54,870 --> 00:50:57,570 So there is the finite element method. 822 00:50:57,570 --> 00:51:02,180 It produced something that you might say, oh, we knew that. 823 00:51:02,180 --> 00:51:08,340 But you've got to see that it deals automatically with c(x), 824 00:51:08,340 --> 00:51:10,220 it deals automatically with f(x), 825 00:51:10,220 --> 00:51:13,810 it deals automatically with the free boundary. 826 00:51:13,810 --> 00:51:18,715 You see, the solution there is going 827 00:51:18,715 --> 00:51:22,600 to take sort of a balance, a pretty close balance, 828 00:51:22,600 --> 00:51:27,420 of this half hat with this one, and the solution will actually 829 00:51:27,420 --> 00:51:30,800 be a pretty close to free. 830 00:51:30,800 --> 00:51:34,540 It'll be pretty close to having the right zero slope there. 831 00:51:34,540 --> 00:51:36,360 OK, good.