1 00:00:01,540 --> 00:00:03,910 The following content is provided under a Creative 2 00:00:03,910 --> 00:00:05,300 Commons license. 3 00:00:05,300 --> 00:00:07,510 Your support will help MIT OpenCourseWare 4 00:00:07,510 --> 00:00:11,600 continue to offer high quality educational resources for free. 5 00:00:11,600 --> 00:00:14,140 To make a donation or to view additional materials 6 00:00:14,140 --> 00:00:18,100 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:18,100 --> 00:00:19,310 at ocw.mit.edu. 8 00:00:25,412 --> 00:00:27,370 PROFESSOR: So today we're going to keep talking 9 00:00:27,370 --> 00:00:29,280 about boundary value problems. 10 00:00:29,280 --> 00:00:32,080 We'll do that again on Wednesday. 11 00:00:32,080 --> 00:00:37,195 On Friday we'll start partial differential equations. 12 00:00:37,195 --> 00:00:41,260 And next week we'll work with COMSOL, 13 00:00:41,260 --> 00:00:44,890 which I hope you guys all have installed on your laptops. 14 00:00:44,890 --> 00:00:47,020 Please check that you have it installed 15 00:00:47,020 --> 00:00:50,590 and you can turn it on, your licensing things 16 00:00:50,590 --> 00:00:51,850 work and stuff like that. 17 00:00:51,850 --> 00:00:56,034 We'll have a COMSOL tutorial I think on Monday in class. 18 00:00:56,034 --> 00:00:58,200 And you'll use that for one of the homework problems 19 00:00:58,200 --> 00:01:00,430 not immediately but coming up. 20 00:01:06,790 --> 00:01:10,780 Speaking of the homework, I received some feedback 21 00:01:10,780 --> 00:01:13,630 that the homeworks have been taking 22 00:01:13,630 --> 00:01:16,000 an inordinate amount of time. 23 00:01:16,000 --> 00:01:19,240 And so I've discussed this with the other people involved 24 00:01:19,240 --> 00:01:22,060 in teaching it and we decided to drastically cut 25 00:01:22,060 --> 00:01:25,060 the amount of points given for write-ups to try 26 00:01:25,060 --> 00:01:28,340 to encourage you not to spend so much time on that. 27 00:01:28,340 --> 00:01:30,946 And instead I'd really rather you spent the time 28 00:01:30,946 --> 00:01:32,570 and did the reading instead of spending 29 00:01:32,570 --> 00:01:35,249 an extra hour doing write-up. 30 00:01:35,249 --> 00:01:37,040 You won't get any more points for doing it. 31 00:01:37,040 --> 00:01:37,270 So if you want-- 32 00:01:37,270 --> 00:01:38,650 I mean, I love beautiful write-ups. 33 00:01:38,650 --> 00:01:41,020 I'm sure the graders appreciate the beautiful write-ups. 34 00:01:41,020 --> 00:01:43,040 It's good for your thinking to write clearly 35 00:01:43,040 --> 00:01:45,360 but it's not worth many, many hours of time. 36 00:01:48,690 --> 00:01:51,280 And in general, the instructions at the beginning of course, 37 00:01:51,280 --> 00:01:54,420 are on average over the course, your 14 weeks, 38 00:01:54,420 --> 00:01:57,230 it should be about nine hours per week of homework. 39 00:01:57,230 --> 00:01:59,475 So that's maybe 13 hours per assignment, 40 00:01:59,475 --> 00:02:00,980 so you have 10 assignments. 41 00:02:00,980 --> 00:02:04,424 And so if it's getting to be 15 hours, 42 00:02:04,424 --> 00:02:06,590 you've spent too much time on it and just forget it. 43 00:02:06,590 --> 00:02:09,300 Just draw a line and say I'm done, time ran out, 44 00:02:09,300 --> 00:02:12,640 and that's fine. 45 00:02:12,640 --> 00:02:16,082 This is-- getting the last bug out of your Matlab code 46 00:02:16,082 --> 00:02:17,790 is not the main objective of this course. 47 00:02:23,990 --> 00:02:25,640 And really, the purpose of homework 48 00:02:25,640 --> 00:02:28,117 is to help you learn, not that we 49 00:02:28,117 --> 00:02:30,200 need to know what the solution to this problem is. 50 00:02:30,200 --> 00:02:30,947 This is now-- 51 00:02:30,947 --> 00:02:33,280 I'm getting the solution from somebody else in the class 52 00:02:33,280 --> 00:02:33,946 too so this is-- 53 00:02:33,946 --> 00:02:36,465 I don't need it from you. 54 00:02:36,465 --> 00:02:38,090 The TAs probably already did it already 55 00:02:38,090 --> 00:02:39,381 and they have the solution too. 56 00:02:39,381 --> 00:02:41,080 So we know the solution. 57 00:02:41,080 --> 00:02:42,320 It's not so essential. 58 00:02:42,320 --> 00:02:44,736 Its purpose is to help you learn and how to figure it out. 59 00:02:44,736 --> 00:02:46,580 And beyond a certain point, it's not 60 00:02:46,580 --> 00:02:50,860 that instructive in my experience. 61 00:02:50,860 --> 00:02:52,777 Though sometimes the fifteenth and a half hour 62 00:02:52,777 --> 00:02:55,110 you suddenly have the great insight and you learn a lot, 63 00:02:55,110 --> 00:02:56,090 but most the time not. 64 00:03:01,020 --> 00:03:12,450 And by the way the reading is in [? Beer's ?] textbook 65 00:03:12,450 --> 00:03:19,490 pages 258 to 311. 66 00:03:19,490 --> 00:03:22,740 And there's also some nice short readings by Professor 67 00:03:22,740 --> 00:03:25,770 [? Brautz ?] that have been posted, only a few pages long 68 00:03:25,770 --> 00:03:28,320 but definitely worth a look. 69 00:03:28,320 --> 00:03:38,580 Both on [? PPPs ?] and also in ODEs and [? DAEs. ?] 70 00:03:38,580 --> 00:03:40,590 So today what we're going to talk about 71 00:03:40,590 --> 00:03:44,510 is relaxation methods. 72 00:03:59,250 --> 00:04:02,800 And we talked last time about the shooting method. 73 00:04:02,800 --> 00:04:04,530 So that's a good method. 74 00:04:07,999 --> 00:04:09,540 At least one famous numerical methods 75 00:04:09,540 --> 00:04:12,240 book recommends you always shoot first then relax. 76 00:04:12,240 --> 00:04:14,130 So try the shooting method. 77 00:04:14,130 --> 00:04:15,511 If it works, you're done. 78 00:04:15,511 --> 00:04:17,010 If it doesn't work for you, then you 79 00:04:17,010 --> 00:04:20,019 may have to use a relaxation method. 80 00:04:20,019 --> 00:04:22,920 And we'll talk a bit now about the relaxation methods. 81 00:04:22,920 --> 00:04:28,480 And the general idea is you're going to write your y-- 82 00:04:28,480 --> 00:04:29,940 which is an approximation, it's not 83 00:04:29,940 --> 00:04:31,750 going to be the real solution-- 84 00:04:31,750 --> 00:04:36,700 and you're going to try to write that typically 85 00:04:36,700 --> 00:04:41,200 as an expansion to some basis functions. 86 00:04:41,200 --> 00:04:43,230 So let's say the nth component of y. 87 00:04:50,310 --> 00:04:53,220 And then you're going to vary these coefficients, the d's, 88 00:04:53,220 --> 00:04:55,379 to try to make your solution as good as possible. 89 00:04:55,379 --> 00:04:57,420 And now we're talking about different definitions 90 00:04:57,420 --> 00:05:02,850 of what good is for the solution for a problem. 91 00:05:02,850 --> 00:05:05,040 And you have to be aware that almost always, this 92 00:05:05,040 --> 00:05:09,190 will not exactly solve the differential equation system. 93 00:05:09,190 --> 00:05:12,453 So it's always going to be wrong everywhere, typically. 94 00:05:12,453 --> 00:05:15,059 And you can get to decide sort of-- 95 00:05:15,059 --> 00:05:17,100 if you wanted to be good at some particular spot, 96 00:05:17,100 --> 00:05:18,840 you can do something about that. 97 00:05:18,840 --> 00:05:22,260 If you wanted to, on average, be good in some way, 98 00:05:22,260 --> 00:05:23,790 you can decide that. 99 00:05:23,790 --> 00:05:28,020 And it's sort of how much error you can tolerate. 100 00:05:28,020 --> 00:05:31,840 And in general, you have to do a finite sum of a finite basis 101 00:05:31,840 --> 00:05:32,610 set. 102 00:05:32,610 --> 00:05:35,045 For many, many ODE, [? PPP ?] problems, 103 00:05:35,045 --> 00:05:37,170 there's math proofs that if-- and the limit is this 104 00:05:37,170 --> 00:05:39,240 goes to infinity if you add an infinite number of functions 105 00:05:39,240 --> 00:05:39,900 here. 106 00:05:39,900 --> 00:05:42,844 You can always make it work to get the true solution. 107 00:05:42,844 --> 00:05:44,760 But you can never afford that so you're always 108 00:05:44,760 --> 00:05:48,960 finite truncated basis set is what you're using. 109 00:05:48,960 --> 00:05:50,879 And so a lot of the accuracy things 110 00:05:50,879 --> 00:05:52,920 have to do with exactly what functions you choose 111 00:05:52,920 --> 00:05:56,340 and exactly how many of these terms and sum you include. 112 00:05:56,340 --> 00:05:59,236 But typically, these problems will start from the beginning, 113 00:05:59,236 --> 00:06:00,860 you'll say I'm only going to include so 114 00:06:00,860 --> 00:06:05,310 many, how big my computer is. 115 00:06:05,310 --> 00:06:07,654 And so you're going to be stuck with some error, 116 00:06:07,654 --> 00:06:08,820 so that's just the way this. 117 00:06:13,916 --> 00:06:15,290 Let's recall the problem we have. 118 00:06:15,290 --> 00:06:17,270 If we write it in the-- 119 00:06:17,270 --> 00:06:19,265 as a first order ODE system, it's dy/dt-- 120 00:06:23,350 --> 00:06:28,650 well, there's some function of dy/dt and y and t 121 00:06:28,650 --> 00:06:33,010 that's equal to zero which often can be written something 122 00:06:33,010 --> 00:06:40,898 like this, dy/dt is equal to an f [INAUDIBLE].. 123 00:06:40,898 --> 00:06:42,320 Right? 124 00:06:42,320 --> 00:06:47,820 And so if you plug in this approximation for y, 125 00:06:47,820 --> 00:06:53,460 then you'll get something here that will be some g of t that's 126 00:06:53,460 --> 00:06:56,280 generally not going to equal zero, 127 00:06:56,280 --> 00:06:57,680 but you would like it to be zero. 128 00:06:57,680 --> 00:06:59,910 If you put the true solution in, you would get zero. 129 00:06:59,910 --> 00:07:01,950 If you put your approximate solution, 130 00:07:01,950 --> 00:07:04,450 it is not going to be zero. 131 00:07:04,450 --> 00:07:06,550 So you'll get g of t and you want 132 00:07:06,550 --> 00:07:11,010 this equal to zero for all t. 133 00:07:14,010 --> 00:07:17,940 And then in addition, you have boundary conditions. 134 00:07:17,940 --> 00:07:21,870 And so you have boundary conditions on the solution 135 00:07:21,870 --> 00:07:24,175 and you want those things to be satisfied. 136 00:07:24,175 --> 00:07:25,800 And again, you can write them in a form 137 00:07:25,800 --> 00:07:27,870 that something has to be zero. 138 00:07:27,870 --> 00:07:31,147 Often, you'll exactly satisfy them. 139 00:07:31,147 --> 00:07:32,730 So you'll choose your solution to make 140 00:07:32,730 --> 00:07:34,890 sure it satisfies the boundary conditions 141 00:07:34,890 --> 00:07:36,417 and it won't satisfy in the domain. 142 00:07:36,417 --> 00:07:38,500 It won't really satisfy the differential equation. 143 00:07:38,500 --> 00:07:41,345 That's the most common thing to do. 144 00:07:41,345 --> 00:07:43,720 But it could also be that it doesn't satisfy the boundary 145 00:07:43,720 --> 00:07:47,130 conditions either, but you want to be close to satisfy 146 00:07:47,130 --> 00:07:48,245 the boundary conditions. 147 00:07:50,910 --> 00:07:56,250 We have to think of how are we going 148 00:07:56,250 --> 00:08:00,810 to judge if the solution is accurate or not, 149 00:08:00,810 --> 00:08:02,310 if our approximate solution is good? 150 00:08:08,290 --> 00:08:11,350 And from the way we wrote it, we have our parameters, d. 151 00:08:11,350 --> 00:08:13,300 These are numbers we can adjust. 152 00:08:13,300 --> 00:08:15,940 And we're going to try to adjust them to make the solution as 153 00:08:15,940 --> 00:08:17,850 good as possible. 154 00:08:17,850 --> 00:08:19,580 And now we just define what a good means. 155 00:08:19,580 --> 00:08:23,610 There are several definitions of good that are widely used. 156 00:08:23,610 --> 00:08:28,469 And one of them is called collocation. 157 00:08:28,469 --> 00:08:29,760 This is like option number one. 158 00:08:33,919 --> 00:08:44,310 And that is you choose a set of ts, of particular time points. 159 00:08:44,310 --> 00:08:46,800 And for those particular type points 160 00:08:46,800 --> 00:08:52,920 you demand that g of the time point is equal to zero. 161 00:08:52,920 --> 00:08:58,170 So you're forcing the residuals-- this is called 162 00:08:58,170 --> 00:09:01,320 the residual, it's the error. 163 00:09:01,320 --> 00:09:03,970 And you're forcing the error to be zero at some particular time 164 00:09:03,970 --> 00:09:05,420 points. 165 00:09:05,420 --> 00:09:07,480 And generally between the time points 166 00:09:07,480 --> 00:09:10,887 it will not be equal to zero. 167 00:09:10,887 --> 00:09:13,220 But you can pick your time points and depending on which 168 00:09:13,220 --> 00:09:15,470 ones you pick, you'll get a slightly different optimal 169 00:09:15,470 --> 00:09:17,720 choice of the d's. 170 00:09:17,720 --> 00:09:19,970 Because the d's will be adjusted to force 171 00:09:19,970 --> 00:09:23,610 the residual to be zero at your time points you pick. 172 00:09:23,610 --> 00:09:26,200 So that's one option. 173 00:09:26,200 --> 00:09:28,381 Another one is called Rayleigh-Ritz. 174 00:09:34,770 --> 00:09:41,450 And that one is you minimize overall your d's. 175 00:09:45,572 --> 00:09:55,968 The integral in t zero to t final of the norm of g of t. 176 00:10:01,720 --> 00:10:04,330 So this means you try to make the average 177 00:10:04,330 --> 00:10:08,940 of the square of that deviation to be as small as possible. 178 00:10:08,940 --> 00:10:10,980 So it's like sort of like a least squares fit 179 00:10:10,980 --> 00:10:13,260 kind of thing. 180 00:10:13,260 --> 00:10:16,180 So that's another option. 181 00:10:16,180 --> 00:10:18,550 And then a third one that people use 182 00:10:18,550 --> 00:10:20,020 a lot is called Galerkin's Method. 183 00:10:23,470 --> 00:10:31,925 And his method is you choose some functions-- 184 00:10:31,925 --> 00:10:35,390 some of your basis functions typically-- 185 00:10:35,390 --> 00:10:38,524 and you integrate them with each of the elements 186 00:10:38,524 --> 00:10:39,190 of the residual. 187 00:10:42,940 --> 00:10:46,310 And you demand that that has to be equal to zero. 188 00:10:46,310 --> 00:10:46,967 Yeah? 189 00:10:46,967 --> 00:10:49,402 AUDIENCE: [INAUDIBLE] for [? this method, ?] 190 00:10:49,402 --> 00:10:50,870 what do you [INAUDIBLE]? 191 00:10:50,870 --> 00:10:54,259 PROFESSOR: The d's, your coefficients. 192 00:10:54,259 --> 00:10:55,800 And these ones, I didn't write it out 193 00:10:55,800 --> 00:10:58,580 but this g depends implicitly on the d's, 194 00:10:58,580 --> 00:11:01,166 so you can write it that way. 195 00:11:01,166 --> 00:11:04,152 A lot of d's. 196 00:11:04,152 --> 00:11:07,460 And so you optimize the d's, you very the d's 197 00:11:07,460 --> 00:11:11,520 to force g to be zero at certain ts. 198 00:11:11,520 --> 00:11:15,490 And this one also, the g depends on d's. 199 00:11:15,490 --> 00:11:17,410 And so you're going to optimize the d's 200 00:11:17,410 --> 00:11:21,395 to force this integral equation to be satisfied. 201 00:11:21,395 --> 00:11:21,895 Yeah? 202 00:11:21,895 --> 00:11:25,109 AUDIENCE: [INAUDIBLE] all changing d's? 203 00:11:25,109 --> 00:11:25,775 PROFESSOR: Yeah. 204 00:11:25,775 --> 00:11:26,816 They're all changing d's. 205 00:11:26,816 --> 00:11:30,590 And it's just trying to-- your criterion, your error measure, 206 00:11:30,590 --> 00:11:34,194 how do you measure or what do you think is good? 207 00:11:34,194 --> 00:11:36,360 You want to make something small, some kind of error 208 00:11:36,360 --> 00:11:37,170 small, but you have to figure out 209 00:11:37,170 --> 00:11:38,550 what are you going to define your error to be. 210 00:11:38,550 --> 00:11:40,383 And you'll get different solutions depending 211 00:11:40,383 --> 00:11:42,160 on which error measure you use. 212 00:11:45,170 --> 00:11:45,950 Is this OK? 213 00:11:49,950 --> 00:11:54,820 Now this one's pretty straightforward. 214 00:11:54,820 --> 00:11:57,675 I'm just going to write it down a bunch of algebraic equations 215 00:11:57,675 --> 00:11:59,966 that depend on my d's and then I'm going to solve them. 216 00:11:59,966 --> 00:12:05,680 And this looks a lot like [? an f ?] [? solve ?] problem. 217 00:12:05,680 --> 00:12:07,845 This is a Newton problem or something like that. 218 00:12:07,845 --> 00:12:10,125 So it's just some algebraic equations. 219 00:12:10,125 --> 00:12:12,149 Should be OK? 220 00:12:12,149 --> 00:12:14,690 So that one you should be pretty well set up to do right now. 221 00:12:14,690 --> 00:12:17,190 Let's just think of how many equations there are. 222 00:12:17,190 --> 00:12:27,340 So we have-- say we have our basis set yf t dni fit. 223 00:12:30,360 --> 00:12:31,630 That's our basis set. 224 00:12:31,630 --> 00:12:35,890 And this is a sum over i equals one to say 225 00:12:35,890 --> 00:12:37,790 the number of basis functions. 226 00:12:37,790 --> 00:12:39,040 What do you want to call that? 227 00:12:42,672 --> 00:12:44,190 N, sound good? 228 00:12:44,190 --> 00:12:46,590 So we have n basis functions. 229 00:12:46,590 --> 00:12:50,524 And so we have how many unknowns here? 230 00:12:50,524 --> 00:12:52,190 Maybe n's not good because n's this one. 231 00:12:52,190 --> 00:12:53,600 Let's call it something else. 232 00:12:53,600 --> 00:12:55,130 k, OK. 233 00:12:55,130 --> 00:12:56,172 All right? 234 00:12:56,172 --> 00:12:57,630 In fact, I'll even change this to k 235 00:12:57,630 --> 00:12:58,900 too just to make life easier. 236 00:13:02,940 --> 00:13:07,140 So there are how many dnk's are there? 237 00:13:07,140 --> 00:13:09,510 There's n where n is the dimension, 238 00:13:09,510 --> 00:13:13,490 the number of od's or the number of components in y times k. 239 00:13:13,490 --> 00:13:20,894 That's how many d's we got that we're going to adjust. 240 00:13:20,894 --> 00:13:23,310 We want to have an equal number of equations and unknowns. 241 00:13:23,310 --> 00:13:25,060 We have to have as many equations as that. 242 00:13:28,150 --> 00:13:30,790 So what equations do we got? 243 00:13:30,790 --> 00:13:32,010 How many equations? 244 00:13:38,010 --> 00:13:43,100 So if we just have a ODE [? BBP ?] 245 00:13:43,100 --> 00:13:47,088 we typically have n boundary conditions. 246 00:13:51,349 --> 00:13:53,140 So that many boundary conditions because we 247 00:13:53,140 --> 00:13:55,930 need one boundary condition for each differential equation, 248 00:13:55,930 --> 00:13:56,430 right? 249 00:13:56,430 --> 00:13:58,330 One integration constant for each one. 250 00:13:58,330 --> 00:14:02,360 So we took an n boundary conditions. 251 00:14:02,360 --> 00:14:03,510 And then we have-- 252 00:14:03,510 --> 00:14:06,850 in collocation, we have however many capital M time points 253 00:14:06,850 --> 00:14:07,360 we chose. 254 00:14:10,330 --> 00:14:16,760 So we have M n equations-- 255 00:14:16,760 --> 00:14:18,192 no, that's not right. 256 00:14:18,192 --> 00:14:21,345 We have an equation like that for every component of g. 257 00:14:21,345 --> 00:14:28,722 So it's M times n equations from the collocation. 258 00:14:34,024 --> 00:14:36,690 Is that all right? 259 00:14:36,690 --> 00:14:39,150 So just looking at this, it looks 260 00:14:39,150 --> 00:14:47,220 like we have n times M plus one equations 261 00:14:47,220 --> 00:14:52,630 and we have n times k unknowns that we're trying to adjust. 262 00:14:52,630 --> 00:14:56,220 And so therefore, this says we should choose k 263 00:14:56,220 --> 00:14:57,620 to be equal to M plus one. 264 00:15:01,280 --> 00:15:03,760 So if we choose we want to say we want 100 basis functions, 265 00:15:03,760 --> 00:15:07,510 then we need 99 time points to do collocations at it in order 266 00:15:07,510 --> 00:15:10,511 to exactly determine everything. 267 00:15:10,511 --> 00:15:11,360 Is that OK? 268 00:15:13,865 --> 00:15:15,240 How many people think this is OK? 269 00:15:17,830 --> 00:15:18,330 OK. 270 00:15:18,330 --> 00:15:18,829 He agrees. 271 00:15:18,829 --> 00:15:20,090 It's OK. 272 00:15:20,090 --> 00:15:21,899 The rest of you, no opinion. 273 00:15:21,899 --> 00:15:23,690 This is like the American political system. 274 00:15:23,690 --> 00:15:25,370 Only 5% people vote. 275 00:15:25,370 --> 00:15:27,920 Everybody else just listens to Donald Trump. 276 00:15:33,530 --> 00:15:37,750 So this is how many equations we need. 277 00:15:37,750 --> 00:15:42,030 Now sometimes people will choose the basis functions 278 00:15:42,030 --> 00:15:44,540 so that, say, some of the boundary condition equations 279 00:15:44,540 --> 00:15:46,782 might be satisfied automatically. 280 00:15:46,782 --> 00:15:49,090 And I'll talk a little bit in a minute about cleverness 281 00:15:49,090 --> 00:15:51,330 in choosing basis functions. 282 00:15:51,330 --> 00:15:53,830 So one possible thing is you can try to cleverly choose 283 00:15:53,830 --> 00:15:56,560 basis functions so that no matter what values of d's you 284 00:15:56,560 --> 00:15:59,320 choose, you're always going to satisfy some of the boundary 285 00:15:59,320 --> 00:16:01,410 conditions. 286 00:16:01,410 --> 00:16:05,500 And so long as you don't get a full value of n 287 00:16:05,500 --> 00:16:07,640 because some of these boundary conditions 288 00:16:07,640 --> 00:16:10,250 don't help you determine the d's, any values 289 00:16:10,250 --> 00:16:11,380 of d's will work. 290 00:16:11,380 --> 00:16:14,309 And so in those cases, you need a few-- might need another time 291 00:16:14,309 --> 00:16:15,100 point or something. 292 00:16:15,100 --> 00:16:16,335 Get some more equations. 293 00:16:20,320 --> 00:16:21,910 So that's collocation. 294 00:16:21,910 --> 00:16:26,750 And I think this should be perfectly straightforward. 295 00:16:26,750 --> 00:16:28,660 You just evaluate your y's. 296 00:16:28,660 --> 00:16:30,370 You need to have your dy/dts. 297 00:16:30,370 --> 00:16:33,040 You'll need them, because they appear in g as well. 298 00:16:33,040 --> 00:16:37,040 And they're just going to be the summation over k [? of ?] 299 00:16:37,040 --> 00:16:42,880 [? dnk ?] v prime k of t. 300 00:16:42,880 --> 00:16:45,030 And so you choose basis functions 301 00:16:45,030 --> 00:16:47,230 that the analytical derivatives of. 302 00:16:47,230 --> 00:16:49,640 So now you know these answers. 303 00:16:49,640 --> 00:16:55,980 And now you can evaluate this at any time point tm. 304 00:16:55,980 --> 00:16:57,860 So you evaluate your time points. 305 00:16:57,860 --> 00:17:00,190 You evaluate these guys at your time points. 306 00:17:00,190 --> 00:17:04,920 You plug them all into your g expression over here, 307 00:17:04,920 --> 00:17:10,270 and your force is equal to zero, by varying the d's, right? 308 00:17:10,270 --> 00:17:11,534 No problem. 309 00:17:11,534 --> 00:17:12,450 So that's collocation. 310 00:17:12,450 --> 00:17:13,619 That's pretty easy. 311 00:17:13,619 --> 00:17:19,109 And because it's so easy, it's kind of pretty widely used 312 00:17:19,109 --> 00:17:22,447 as one way to go. 313 00:17:22,447 --> 00:17:24,780 All it requires is that you have to know the derivatives 314 00:17:24,780 --> 00:17:27,569 of your basis functions. 315 00:17:27,569 --> 00:17:30,035 In particular, doesn't require any integrals. 316 00:17:30,035 --> 00:17:31,660 When you see the other methods, they're 317 00:17:31,660 --> 00:17:32,784 going to involve integrals. 318 00:17:32,784 --> 00:17:35,520 So we'll have to figure out how we're going evaluate those. 319 00:17:35,520 --> 00:17:37,580 So if you have functions you don't 320 00:17:37,580 --> 00:17:39,800 know how to integrate then this is definitely the way 321 00:17:39,800 --> 00:17:41,900 to go, to do collocation. 322 00:17:41,900 --> 00:17:44,990 And if you use collocation with enough points, 323 00:17:44,990 --> 00:17:47,394 you're forcing the error to be zero a lot of points, 324 00:17:47,394 --> 00:17:49,810 then probably it won't get that big in between the points. 325 00:17:49,810 --> 00:17:51,620 At least you can hope that I won't get 326 00:17:51,620 --> 00:17:53,090 that big between the points. 327 00:17:53,090 --> 00:17:55,310 And you can try it with different numbers of points. 328 00:17:55,310 --> 00:17:56,726 And different size numbers of base 329 00:17:56,726 --> 00:17:59,720 functions and see what you can do. 330 00:17:59,720 --> 00:18:02,120 See if it converges to something, if you're lucky. 331 00:18:02,120 --> 00:18:02,620 All right. 332 00:18:02,620 --> 00:18:04,680 So that's one way to go. 333 00:18:04,680 --> 00:18:07,516 And it's just f solve problem. 334 00:18:07,516 --> 00:18:09,890 And all that's happening is it's just forming a Dracovian 335 00:18:09,890 --> 00:18:11,639 Matrix inside there. 336 00:18:11,639 --> 00:18:14,180 Now, you still have to choose which basis functions you want. 337 00:18:14,180 --> 00:18:15,680 And there's a lot of basis functions 338 00:18:15,680 --> 00:18:19,130 you know that you know the derivatives of. 339 00:18:19,130 --> 00:18:25,250 So there's some issues here about what choice is best. 340 00:18:25,250 --> 00:18:27,321 And we'll talk a little about that in a minute. 341 00:18:27,321 --> 00:18:28,820 One thing you have to watch out for, 342 00:18:28,820 --> 00:18:30,403 is you don't want your basis functions 343 00:18:30,403 --> 00:18:34,370 to be linearly dependent because then you'll end up 344 00:18:34,370 --> 00:18:37,520 with indeterminate values a d. 345 00:18:37,520 --> 00:18:44,080 Different sets of d's will give you exactly the same y. 346 00:18:44,080 --> 00:18:48,290 If these phi's-- if one of these phi's is a linear combination 347 00:18:48,290 --> 00:18:52,455 of other phi's in your set, then you could have different values 348 00:18:52,455 --> 00:18:54,830 of d's that would actually correspond to exactly the same 349 00:18:54,830 --> 00:18:55,460 y. 350 00:18:55,460 --> 00:18:58,850 Because of that, when you a Jacobian Matrix as part of it 351 00:18:58,850 --> 00:19:00,470 your Newton solve, the Jacobian's 352 00:19:00,470 --> 00:19:02,630 going to be singular, and then the whole thing's 353 00:19:02,630 --> 00:19:04,570 not going to work. 354 00:19:04,570 --> 00:19:07,337 So that's one thing to watch out for. 355 00:19:07,337 --> 00:19:08,920 And actually, it doesn't really matter 356 00:19:08,920 --> 00:19:12,610 if the functions are orthogonal in the sense of being functions 357 00:19:12,610 --> 00:19:18,940 orthogonal, it's really whether the vector, vk evaluated tm, 358 00:19:18,940 --> 00:19:21,049 if those are independent of each other or not. 359 00:19:21,049 --> 00:19:23,340 I feel like we talked about this before, one time, yes? 360 00:19:23,340 --> 00:19:23,840 Yes. 361 00:19:23,840 --> 00:19:25,710 All right. 362 00:19:25,710 --> 00:19:28,650 So anyway, as long as the vk evaluate of tm, 363 00:19:28,650 --> 00:19:30,210 if those things are vectors which 364 00:19:30,210 --> 00:19:31,970 are not linerally dependent on each other, 365 00:19:31,970 --> 00:19:33,474 this should work fine. 366 00:19:33,474 --> 00:19:35,720 OK? 367 00:19:35,720 --> 00:19:36,220 All right. 368 00:19:40,680 --> 00:19:44,310 Now, really [INAUDIBLE]. 369 00:19:44,310 --> 00:19:49,890 This one here often gets to be kind of messy. 370 00:19:49,890 --> 00:19:53,860 Part of it is that inside this norm of this vector, 371 00:19:53,860 --> 00:19:57,035 it's square, so you end up getting squares of your d's. 372 00:19:57,035 --> 00:19:58,410 So, the whole thing is definitely 373 00:19:58,410 --> 00:20:01,155 non-linear in d to start with. 374 00:20:01,155 --> 00:20:03,780 And then you have to be able to evaluate all the integrals that 375 00:20:03,780 --> 00:20:04,310 come up. 376 00:20:04,310 --> 00:20:12,840 So this is really sum over n, of g 377 00:20:12,840 --> 00:20:23,262 and of td squared that you're trying to integrate. 378 00:20:23,262 --> 00:20:26,800 [INAUDIBLE] Right? 379 00:20:26,800 --> 00:20:29,770 So, you have a lot of these function squared. 380 00:20:29,770 --> 00:20:31,430 You have to add them up. 381 00:20:31,430 --> 00:20:34,370 You could do it, but the algebra gets a little complicated. 382 00:20:34,370 --> 00:20:36,900 So, this is not so commonly done unless the g 383 00:20:36,900 --> 00:20:40,005 has some special form that makes the algebra a little easier. 384 00:20:40,005 --> 00:20:42,130 But there's no reason you can't do it in principle, 385 00:20:42,130 --> 00:20:45,030 but it just is a little bit of a mess because you get a lot 386 00:20:45,030 --> 00:20:48,260 of integrals of cross terms between the g's. 387 00:20:48,260 --> 00:20:51,040 And in the d's inside there. 388 00:20:51,040 --> 00:20:55,510 And so, not so commonly done. 389 00:20:55,510 --> 00:20:57,470 Though one case where it is done a lot 390 00:20:57,470 --> 00:20:59,990 is in actually quantum chemistry. 391 00:20:59,990 --> 00:21:02,780 Methods called variational methods in quantum chemistry 392 00:21:02,780 --> 00:21:05,900 use real [INAUDIBLE] to figure out the coefficients, 393 00:21:05,900 --> 00:21:08,520 and like your orbitals, and stuff like that. 394 00:21:08,520 --> 00:21:10,080 So, it'd be certain methods. 395 00:21:10,080 --> 00:21:12,080 But they've actually gone out of favor recently. 396 00:21:12,080 --> 00:21:14,500 So, you probably won't use it that often. 397 00:21:14,500 --> 00:21:17,960 But in the past, that was a big deal. 398 00:21:17,960 --> 00:21:22,070 Galerkin is used the most of anything, 399 00:21:22,070 --> 00:21:25,950 so let's talk about that one for a minute. 400 00:21:25,950 --> 00:21:29,210 Now, the concept, where does this equation come from? 401 00:21:29,210 --> 00:21:30,840 I guess that's one thing. 402 00:21:30,840 --> 00:21:32,960 So maybe we can back up and say, well, 403 00:21:32,960 --> 00:21:35,274 where did the collocation come from? 404 00:21:35,274 --> 00:21:37,190 Collocation is actually like a special version 405 00:21:37,190 --> 00:21:40,340 of this where I choose, instead of these basis functions, 406 00:21:40,340 --> 00:21:42,540 I use delta functions. 407 00:21:42,540 --> 00:21:47,460 So, if I integrated with delta functions, t minus tm. 408 00:21:47,460 --> 00:21:49,320 Another way to look at the collocation 409 00:21:49,320 --> 00:21:55,440 is demanding that the integral of delta function t minus tm g 410 00:21:55,440 --> 00:22:01,100 n a t dt is equal to zero. 411 00:22:01,100 --> 00:22:03,540 OK. 412 00:22:03,540 --> 00:22:07,550 So, now instead of using delta functions, 413 00:22:07,550 --> 00:22:09,450 I'm using these functions. 414 00:22:09,450 --> 00:22:11,250 Basis functions. 415 00:22:11,250 --> 00:22:13,300 So I don't know if it's particularly obvious why 416 00:22:13,300 --> 00:22:16,180 you'd use one or the other, but anyway, you have a choice. 417 00:22:16,180 --> 00:22:19,560 And any time you do this kind of integral with some number 418 00:22:19,560 --> 00:22:22,110 of functions, you get some number of equations that can 419 00:22:22,110 --> 00:22:25,032 help you determine the d's. 420 00:22:25,032 --> 00:22:29,250 This particular choice of the basis functions-- 421 00:22:29,250 --> 00:22:34,740 one way to look at it is, you can say, well, suppose 422 00:22:34,740 --> 00:22:43,540 my solution g g n, suppose I could write this 423 00:22:43,540 --> 00:22:47,770 as a sum of some different expansion coefficients. 424 00:22:59,760 --> 00:23:22,857 So I can relate this plus 425 00:23:22,857 --> 00:23:23,940 OK, so, there's two terms. 426 00:23:23,940 --> 00:23:26,870 One is the expansion of the residuals in the basis 427 00:23:26,870 --> 00:23:30,909 that I'm using, and one is all the rest 428 00:23:30,909 --> 00:23:32,700 going on to infinity of all the other basis 429 00:23:32,700 --> 00:23:35,140 functions in the universe. 430 00:23:35,140 --> 00:23:40,230 And if I think my basis set is very complete, that it kind 431 00:23:40,230 --> 00:23:41,820 of cover all the kinds of functions 432 00:23:41,820 --> 00:23:45,270 I'm ever going to deal with, both in y and in g, 433 00:23:45,270 --> 00:23:48,214 in the residual, then this would be a reasonable thing, 434 00:23:48,214 --> 00:23:50,130 and you might expect that this term-- if you'd 435 00:23:50,130 --> 00:23:52,990 pick big K big enough, this might be small. 436 00:23:52,990 --> 00:23:54,780 So that's sort of where the idea is. 437 00:23:54,780 --> 00:23:58,480 So then, if I think this is small, 438 00:23:58,480 --> 00:24:00,540 then I want to make sure I make this part as 439 00:24:00,540 --> 00:24:03,340 close to accurate as possible. 440 00:24:03,340 --> 00:24:07,370 And this condition is basically doing that. 441 00:24:07,370 --> 00:24:13,750 It's saying that I want the [? error ?] to be orthogonal 442 00:24:13,750 --> 00:24:17,030 to the basis functions, in the sense that, 443 00:24:17,030 --> 00:24:19,655 for two functions, the integral of the two functions like this, 444 00:24:19,655 --> 00:24:21,863 is like an inner product, just like the inner product 445 00:24:21,863 --> 00:24:23,020 between two vectors. 446 00:24:23,020 --> 00:24:25,360 So I'm saying, like, in the vector space, 447 00:24:25,360 --> 00:24:27,310 in the function space that I'm working in, 448 00:24:27,310 --> 00:24:28,610 I don't want to have any error. 449 00:24:28,610 --> 00:24:30,430 That's what this is saying. 450 00:24:30,430 --> 00:24:34,390 But I'm going to have is that there's other g terms which 451 00:24:34,390 --> 00:24:36,610 are the rest over here. 452 00:24:36,610 --> 00:24:42,360 These guys will not be orthogonal to the first part. 453 00:24:42,360 --> 00:24:44,160 Does that make sense? 454 00:24:44,160 --> 00:24:47,270 So there's still some error left, in my g. 455 00:24:47,270 --> 00:24:52,480 But the part in here, I can make a good [? answer. ?] 456 00:24:52,480 --> 00:24:56,331 So that's where this equation comes from conceptually. 457 00:24:56,331 --> 00:24:58,205 All right. 458 00:24:58,205 --> 00:25:00,705 And we'll come back-- when we do least square [? setting, ?] 459 00:25:00,705 --> 00:25:03,090 we'll come back to that same idea. 460 00:25:06,930 --> 00:25:08,970 So this is what the equation looks like, 461 00:25:08,970 --> 00:25:15,310 and the disadvantage of this one is it involves some integrals. 462 00:25:15,310 --> 00:25:18,520 And so you have to be able to evaluate the integrals. 463 00:25:18,520 --> 00:25:20,080 All right. 464 00:25:20,080 --> 00:25:22,580 So that's the downside of this function. 465 00:25:22,580 --> 00:25:24,580 So cleverly choosing using your basis functions 466 00:25:24,580 --> 00:25:27,790 to make it easy to evaluate the integrals is like the key thing 467 00:25:27,790 --> 00:25:28,960 to make this a good method. 468 00:25:31,790 --> 00:25:35,210 And just like we needed analytical expressions 469 00:25:35,210 --> 00:25:38,450 for the derivatives here, now we need analytical expressions 470 00:25:38,450 --> 00:25:39,550 for integrals. 471 00:25:39,550 --> 00:25:41,340 That we're going to get from this guy. 472 00:25:41,340 --> 00:25:41,840 OK. 473 00:25:45,960 --> 00:25:49,170 So, let's think about what basis functions we can choose that 474 00:25:49,170 --> 00:25:52,260 might make it easier to evaluate the integrals. 475 00:25:52,260 --> 00:25:54,220 Suppose we can write g explicitly. 476 00:25:54,220 --> 00:25:54,720 Like, this. 477 00:25:54,720 --> 00:26:02,307 So, g is equal to d gx dyn/dt minus f/n. 478 00:26:05,020 --> 00:26:06,480 Suppose. 479 00:26:06,480 --> 00:26:07,560 OK? 480 00:26:07,560 --> 00:26:10,840 Then what integrals am I going to get? 481 00:26:10,840 --> 00:26:15,420 Well, dyn/dt is the sum of the derivatives of the basis 482 00:26:15,420 --> 00:26:22,290 functions, and y is just this sum up there. 483 00:26:22,290 --> 00:26:24,102 Some of the basis functions. 484 00:26:24,102 --> 00:26:25,560 And so, I'm going to have integrals 485 00:26:25,560 --> 00:26:41,210 that look like this is like I have an integral phi j 486 00:26:41,210 --> 00:26:46,200 summation d phi prime. 487 00:26:46,200 --> 00:26:48,878 No, k. 488 00:26:48,878 --> 00:26:49,378 t. 489 00:26:53,710 --> 00:26:54,210 dt. 490 00:26:54,210 --> 00:26:56,490 That will be the integrals from the first term. 491 00:26:59,320 --> 00:27:05,380 And then I'll have minus some integrals from the second term 492 00:27:05,380 --> 00:27:05,990 here. 493 00:27:05,990 --> 00:27:19,250 So, phi j fn ft y, where y is the sum-- it's actually 494 00:27:19,250 --> 00:27:20,447 like a matrix. 495 00:27:32,640 --> 00:27:33,500 All right. 496 00:27:33,500 --> 00:27:35,510 Because this y is a vector. 497 00:27:35,510 --> 00:27:38,110 It's all the yns. 498 00:27:38,110 --> 00:27:45,400 And so, the whole y vector is d times the phi vector. 499 00:27:51,400 --> 00:27:53,837 All right. 500 00:27:53,837 --> 00:27:54,920 Where d's that big matrix. 501 00:27:54,920 --> 00:28:02,130 The elements are [? dnk. ?] And so, 502 00:28:02,130 --> 00:28:04,920 if you cut these integrals, this thing 503 00:28:04,920 --> 00:28:09,400 here is a summation of [? dnk. ?] 504 00:28:09,400 --> 00:28:11,930 The integral of phi j. 505 00:28:11,930 --> 00:28:12,780 Phi k prime. 506 00:28:18,280 --> 00:28:20,920 And so, if you choose your basis functions cleverly, 507 00:28:20,920 --> 00:28:24,230 you might be able to know all these integrals analytically. 508 00:28:24,230 --> 00:28:24,937 OK? 509 00:28:24,937 --> 00:28:26,520 But if you don't choose them cleverly, 510 00:28:26,520 --> 00:28:28,853 who knows what kind of horrible mess you'll end up here. 511 00:28:28,853 --> 00:28:30,150 All right. 512 00:28:30,150 --> 00:28:32,400 Ideally, you really want to get these all analytically 513 00:28:32,400 --> 00:28:35,029 so you don't have to do numerical integration. 514 00:28:35,029 --> 00:28:36,820 As a loop inside, all the rest of the work, 515 00:28:36,820 --> 00:28:38,893 you're going to do in this problem. 516 00:28:38,893 --> 00:28:40,160 OK? 517 00:28:40,160 --> 00:28:43,310 And then, these ones also, now knowing something about 518 00:28:43,310 --> 00:28:45,350 this is really important or you may 519 00:28:45,350 --> 00:28:48,830 have to do the numerical integration here, because this 520 00:28:48,830 --> 00:28:50,200 could be really a mess. 521 00:28:50,200 --> 00:28:52,490 You have a lot of phis inside some function, which 522 00:28:52,490 --> 00:28:54,466 could be a non-linear function of these guys. 523 00:28:54,466 --> 00:28:56,590 And so, in principle this could be really horrible. 524 00:29:00,350 --> 00:29:05,384 So you may have to do numerical quadrature for those guys. 525 00:29:05,384 --> 00:29:06,348 All right. 526 00:29:13,110 --> 00:29:17,770 OK, and so, if you do Galerkin's method, a big part of that 527 00:29:17,770 --> 00:29:20,080 is thinking ahead of time, oh, what basis function am I 528 00:29:20,080 --> 00:29:20,720 going to use? 529 00:29:20,720 --> 00:29:22,219 How can I make a basis function so I 530 00:29:22,219 --> 00:29:24,550 can evaluate the integrals easily, 531 00:29:24,550 --> 00:29:27,870 and then I might have a chance to do it? 532 00:29:27,870 --> 00:29:29,322 All right, questions so far? 533 00:29:32,268 --> 00:29:34,240 AUDIENCE: Phi j 534 00:29:34,240 --> 00:29:36,990 PROFESSOR: Phi j. 535 00:29:36,990 --> 00:29:38,180 Sorry, phi j of t. 536 00:29:38,180 --> 00:29:39,940 Here, I'll get rid of the t's. 537 00:29:39,940 --> 00:29:41,800 These are both functions of t. 538 00:29:41,800 --> 00:29:44,640 You're integrating over t. 539 00:29:44,640 --> 00:29:47,770 And these integrals from t0 to to t phi. 540 00:29:47,770 --> 00:29:48,870 Your domain. 541 00:29:52,550 --> 00:29:53,420 All right. 542 00:29:53,420 --> 00:29:55,010 Now in Galerkin's method, in addition 543 00:29:55,010 --> 00:29:56,630 to these integral equations, I still 544 00:29:56,630 --> 00:29:58,046 have the integrals, the equations, 545 00:29:58,046 --> 00:29:59,570 that the boundary conditions. 546 00:29:59,570 --> 00:30:01,028 So I still have some equations that 547 00:30:01,028 --> 00:30:06,134 look like collocation equations that are evaluated at tm. 548 00:30:06,134 --> 00:30:08,990 Do I have that anywhere? 549 00:30:08,990 --> 00:30:10,550 Nowhere. 550 00:30:10,550 --> 00:30:12,960 I have an equation like this, except it's not g, it's q, 551 00:30:12,960 --> 00:30:14,819 it's the boundary condition equations 552 00:30:14,819 --> 00:30:16,610 have to be true at the boundary conditions. 553 00:30:16,610 --> 00:30:17,110 Right? 554 00:30:17,110 --> 00:30:21,110 So they're the same as before, q [? or just ?] 555 00:30:21,110 --> 00:30:33,540 before qn of dy/dt evaluated at tn y of tn. 556 00:30:36,396 --> 00:30:37,570 tn. 557 00:30:37,570 --> 00:30:38,530 This is equal to 0. 558 00:30:38,530 --> 00:30:42,320 This is sort of the general way to write a boundary condition. 559 00:30:42,320 --> 00:30:45,240 And so there'll be some special ends, the boundaries, where I 560 00:30:45,240 --> 00:30:47,404 want to have extra conditions. 561 00:30:47,404 --> 00:30:48,820 I'll get some equations like this. 562 00:30:48,820 --> 00:30:52,650 These have to be satisfied in Galerkin's method as well 563 00:30:52,650 --> 00:30:55,650 and they will not be integrals. 564 00:30:55,650 --> 00:30:57,640 They are just that, tn. 565 00:30:57,640 --> 00:31:02,610 And so in addition to the integral equations, that you 566 00:31:02,610 --> 00:31:05,110 have to solve over here, you want these things to be zero 567 00:31:05,110 --> 00:31:07,818 and you also want to satisfy the boundary conditions. 568 00:31:12,950 --> 00:31:15,930 So then, all these methods, a big part of it 569 00:31:15,930 --> 00:31:20,890 gets to be cleverness of a basis function, a choice of basis 570 00:31:20,890 --> 00:31:22,270 functions. 571 00:31:22,270 --> 00:31:26,690 And there's kind of two families of approaches. 572 00:31:26,690 --> 00:31:33,280 So, one family is global basis functions. 573 00:31:33,280 --> 00:31:37,240 So basis functions that are defined on the whole domain. 574 00:31:37,240 --> 00:31:42,280 And there are special ones, sines and cosines, 575 00:31:42,280 --> 00:31:45,630 Bessel functions, all these functions 576 00:31:45,630 --> 00:31:48,210 inferred from your classes, all the special functions. 577 00:31:48,210 --> 00:31:52,605 And a lot of them, the integrals are known for a lot of cases. 578 00:31:52,605 --> 00:31:54,230 There might be special tricks that make 579 00:31:54,230 --> 00:31:56,590 the integrals easy to evaluate. 580 00:31:56,590 --> 00:31:59,740 They can satisfy the boundary conditions automatically. 581 00:31:59,740 --> 00:32:02,590 And some of them, for example, many of the problems 582 00:32:02,590 --> 00:32:06,820 we have with like the heat flow equation, so you have-- 583 00:32:10,070 --> 00:32:12,704 actually it won't be d. 584 00:32:12,704 --> 00:32:14,245 I'm probably going to get this wrong. 585 00:32:14,245 --> 00:32:16,372 It's, like, kappa or alpha. 586 00:32:16,372 --> 00:32:17,600 Which one is it? 587 00:32:17,600 --> 00:32:18,920 Alpha. 588 00:32:18,920 --> 00:32:25,810 Alpha d square of td, x squared minus, there's 589 00:32:25,810 --> 00:32:30,016 some source of heat that might depend on the temperature, 590 00:32:30,016 --> 00:32:31,640 and this has to be, say, equal to zero. 591 00:32:34,980 --> 00:32:38,970 Right, does this seem what you've seen in classes before? 592 00:32:38,970 --> 00:32:40,230 So this is a common one. 593 00:32:40,230 --> 00:32:47,040 So, in this case, you might try t to be a sum of, say, sines. 594 00:32:47,040 --> 00:32:56,440 So [? dnk ?] sine of k something something something. 595 00:32:56,440 --> 00:33:00,600 In there, and the cleverness of this 596 00:33:00,600 --> 00:33:10,740 is that d squared phi k dx squared is 597 00:33:10,740 --> 00:33:14,550 going to be equal to some number times phi k. 598 00:33:14,550 --> 00:33:19,822 Because the second derivatives of sines are also sines. 599 00:33:19,822 --> 00:33:20,760 Right? 600 00:33:20,760 --> 00:33:23,130 So all your differentials will solve 601 00:33:23,130 --> 00:33:27,520 and in fact, the derivatives will be really simple. 602 00:33:27,520 --> 00:33:30,272 Now, the q terms could still be a horrible mess. 603 00:33:30,272 --> 00:33:32,480 For example, this could be an Arrhenius thing where's 604 00:33:32,480 --> 00:33:33,999 the t's up in the exponent. 605 00:33:33,999 --> 00:33:35,790 And then the whole thing might be horrible. 606 00:33:35,790 --> 00:33:36,700 Anyway. 607 00:33:36,700 --> 00:33:39,120 But at least the differential part is, like, super easy. 608 00:33:39,120 --> 00:33:40,320 OK. 609 00:33:40,320 --> 00:33:43,910 And you might have a boundary condition say, at one end, 610 00:33:43,910 --> 00:33:52,600 that dt/dx at someplace like d final x final is equal to zero. 611 00:33:52,600 --> 00:33:53,100 Right? 612 00:33:53,100 --> 00:33:55,060 That might be like, you're up against a x insulator. 613 00:33:55,060 --> 00:33:55,840 Or something like that. 614 00:33:55,840 --> 00:33:57,110 So, you don't have a heat flow. 615 00:33:57,110 --> 00:33:59,230 So that would be a boundary condition you might have. 616 00:33:59,230 --> 00:34:01,730 And then, by cleverly choosing your definition of the sines, 617 00:34:01,730 --> 00:34:04,020 you could force that all the sines satisfy 618 00:34:04,020 --> 00:34:06,082 this derivative condition. 619 00:34:06,082 --> 00:34:12,021 OK, so, rescale your coordinates so that ends up with pi over 2, 620 00:34:12,021 --> 00:34:13,770 an all sides of everything and pi over two 621 00:34:13,770 --> 00:34:17,130 is always zero, the derivative, so you're good. 622 00:34:17,130 --> 00:34:20,019 So, you can do some clever trickiness 623 00:34:20,019 --> 00:34:21,810 to try to make the problem easier to solve. 624 00:34:21,810 --> 00:34:25,050 And so, that's one whole branch of these basis function 625 00:34:25,050 --> 00:34:27,570 methods, is clever basis functions 626 00:34:27,570 --> 00:34:30,239 to match the special problem you have. 627 00:34:30,239 --> 00:34:30,820 OK? 628 00:34:30,820 --> 00:34:33,510 So that's one option. 629 00:34:33,510 --> 00:34:36,844 Then, the other option is the non-clever approach, 630 00:34:36,844 --> 00:34:38,760 where you just say, well, I've got a computer. 631 00:34:38,760 --> 00:34:39,968 Who cares about being clever? 632 00:34:39,968 --> 00:34:41,460 Let's just brute force it. 633 00:34:41,460 --> 00:34:41,961 All right. 634 00:34:41,961 --> 00:34:44,168 And instead, you just want to write a general method, 635 00:34:44,168 --> 00:34:45,270 any problem you can solve. 636 00:34:45,270 --> 00:34:47,020 And this is more or less what COMSOL does. 637 00:34:47,020 --> 00:34:49,100 And you're going to do it. 638 00:34:49,100 --> 00:34:52,750 And so the distinction here is that this kind 639 00:34:52,750 --> 00:34:56,620 of thing, this sine function, has a value everywhere, all 640 00:34:56,620 --> 00:34:57,781 across the domain. 641 00:34:57,781 --> 00:34:59,530 So this is kind of like a global function. 642 00:35:05,571 --> 00:35:06,070 OK? 643 00:35:08,690 --> 00:35:11,570 And the alternative is to do local basis. 644 00:35:11,570 --> 00:35:13,480 Try to have basis functions that are only 645 00:35:13,480 --> 00:35:15,547 defined in little tiny areas. 646 00:35:15,547 --> 00:35:17,630 And then, at least when I integrate the integrals, 647 00:35:17,630 --> 00:35:19,140 I don't have to integrate over the whole range. 648 00:35:19,140 --> 00:35:19,820 I don't have to have to integrate right 649 00:35:19,820 --> 00:35:21,180 around my little basis function. 650 00:35:24,314 --> 00:35:26,980 So, this global basis function-- this is sort of similar to what 651 00:35:26,980 --> 00:35:28,104 we're doing, interpolation? 652 00:35:28,104 --> 00:35:30,520 Do you remember you could use high order polynomial 653 00:35:30,520 --> 00:35:34,030 to interpolate, or you could alternatively 654 00:35:34,030 --> 00:35:36,960 do a little piecewise interpolations, 655 00:35:36,960 --> 00:35:39,820 say, with straight lines between your points. 656 00:35:39,820 --> 00:35:43,150 And, you know, it's not so clear, actually, 657 00:35:43,150 --> 00:35:44,770 which would be the best way to do it. 658 00:35:44,770 --> 00:35:45,820 Or maybe you want to do some combination. 659 00:35:45,820 --> 00:35:47,569 Do little parabolas between little triples 660 00:35:47,569 --> 00:35:48,610 of points, or something. 661 00:35:48,610 --> 00:35:52,060 That might be a good interpolation procedure. 662 00:35:52,060 --> 00:35:53,530 It's the same thing here. 663 00:35:53,530 --> 00:35:56,770 Some problems, you can find a global basis set that works 664 00:35:56,770 --> 00:35:59,110 great and you should use it. 665 00:35:59,110 --> 00:36:00,880 In other problems you might do better 666 00:36:00,880 --> 00:36:03,130 to just break up the domain in little tiny pieces 667 00:36:03,130 --> 00:36:06,290 and then do simple little polynomials or something 668 00:36:06,290 --> 00:36:08,036 in those little domains. 669 00:36:08,036 --> 00:36:09,684 All right. 670 00:36:09,684 --> 00:36:10,850 So this is the global basis. 671 00:36:10,850 --> 00:36:12,730 Let's see a local basis. 672 00:36:17,795 --> 00:36:19,290 It's OK to delete this? 673 00:36:30,650 --> 00:36:33,655 So, local basis functions. 674 00:36:39,672 --> 00:36:44,272 A really common choice for these guys are the b-splines. 675 00:36:47,510 --> 00:36:49,690 And, in particular, first order of b-splines 676 00:36:49,690 --> 00:36:56,085 and these functions have the shape phi phi k, 677 00:36:56,085 --> 00:36:57,090 it looks like this. 678 00:37:14,560 --> 00:37:20,190 So, at zero, all the way up to ti minus 1. 679 00:37:20,190 --> 00:37:23,860 Then it goes up to one at ti, and then it 680 00:37:23,860 --> 00:37:27,930 goes down to zero again, and goes out. 681 00:37:27,930 --> 00:37:28,430 OK. 682 00:37:28,430 --> 00:37:30,110 So this function is a b-spline. 683 00:37:30,110 --> 00:37:33,110 It's also called a tent function because it looks like a tent. 684 00:37:33,110 --> 00:37:34,700 Some people call it a hat function. 685 00:37:34,700 --> 00:37:36,920 I don't have a pointy head so it doesn't look like a hat to me, 686 00:37:36,920 --> 00:37:38,670 but they call it a hat function so I guess 687 00:37:38,670 --> 00:37:42,260 they must have hats like that. 688 00:37:42,260 --> 00:37:45,260 And this is a very common basis set. 689 00:37:45,260 --> 00:37:48,560 And the nice thing about this basis function 690 00:37:48,560 --> 00:37:54,198 is, it's zero except in this little tiny domain around it. 691 00:37:54,198 --> 00:37:55,540 OK? 692 00:37:55,540 --> 00:37:59,310 And it's the only basis function in the whole set that 693 00:37:59,310 --> 00:38:01,960 has a non-zero value of ti. 694 00:38:01,960 --> 00:38:04,820 And so if you want the function to equal something in ti, 695 00:38:04,820 --> 00:38:07,190 it's going to be equal to the coefficient of this basis 696 00:38:07,190 --> 00:38:07,856 function, right? 697 00:38:07,856 --> 00:38:11,630 Because we're going to write y n of t 698 00:38:11,630 --> 00:38:17,960 is equal to summation [? dnk ?] phi k of t. 699 00:38:17,960 --> 00:38:23,500 And so, if I really care about yn evaluated at ti, 700 00:38:23,500 --> 00:38:27,610 the only one basis function this whole sum is going 701 00:38:27,610 --> 00:38:29,240 to have a non-zero value there. 702 00:38:29,240 --> 00:38:37,070 So that's going to be equal to dn dnk, k 703 00:38:37,070 --> 00:38:40,031 where this is the special k. 704 00:38:40,031 --> 00:38:42,625 k prime matches up to ti. 705 00:38:44,880 --> 00:38:47,130 OK, so there's one base function that looks like this. 706 00:38:47,130 --> 00:38:50,870 There's another one over here that's 707 00:38:50,870 --> 00:38:52,760 the one base center on this point, 708 00:38:52,760 --> 00:38:54,630 and there's another one over here. 709 00:38:54,630 --> 00:38:56,354 So on this point, it's [INAUDIBLE].. 710 00:38:56,354 --> 00:38:58,520 And I have as many basis functions as I have points. 711 00:39:01,070 --> 00:39:04,610 So this is like a way I discretize the problem, 712 00:39:04,610 --> 00:39:09,030 but I've kept my solution as continuous function 713 00:39:09,030 --> 00:39:10,820 because my y-- 714 00:39:10,820 --> 00:39:12,650 that's the sum of these guys-- 715 00:39:12,650 --> 00:39:14,490 has a value everywhere. 716 00:39:14,490 --> 00:39:16,487 It's a continuous function. 717 00:39:16,487 --> 00:39:18,570 The way this is written it looks like it might not 718 00:39:18,570 --> 00:39:20,850 be differentiable at all the points 719 00:39:20,850 --> 00:39:23,640 because it has all these kinks, but there's 720 00:39:23,640 --> 00:39:27,660 a clever trick you can do to deal with the kinks. 721 00:39:27,660 --> 00:39:30,264 So, actually, it's not a problem. 722 00:39:30,264 --> 00:39:32,122 AUDIENCE: So, for these basis functions, 723 00:39:32,122 --> 00:39:34,080 how would you define if you had the boundaries? 724 00:39:34,080 --> 00:39:35,821 Like t0? 725 00:39:35,821 --> 00:39:38,320 PROFESSOR: So, you'll have a basis function at the very end. 726 00:39:38,320 --> 00:39:40,460 Suppose this is t0 here. 727 00:39:40,460 --> 00:39:43,940 You have one like that. 728 00:39:43,940 --> 00:39:46,830 OK, so it's just a half of a tent. 729 00:39:46,830 --> 00:39:49,250 Can you get a [? sparse ?] d-matrix? 730 00:39:49,250 --> 00:39:49,920 Yes. 731 00:39:49,920 --> 00:39:51,710 So locality is really good because it 732 00:39:51,710 --> 00:39:56,690 makes the Jacobian matrix sparse, the overall problem. 733 00:39:56,690 --> 00:40:02,510 So, when I compute the integrals of this thing, 734 00:40:02,510 --> 00:40:14,160 for example, the integral of phi i of t, phi i minus 1 of t dt, 735 00:40:14,160 --> 00:40:19,880 this turns out to be equal to 1 or 2 times ti minus ti 736 00:40:19,880 --> 00:40:20,880 [INAUDIBLE]. 737 00:40:23,863 --> 00:40:26,280 No. 738 00:40:26,280 --> 00:40:27,100 I take that back. 739 00:40:27,100 --> 00:40:29,150 Just one half. 740 00:40:29,150 --> 00:40:31,920 Just half. 741 00:40:31,920 --> 00:40:35,750 So it is like a brilliant thing. 742 00:40:35,750 --> 00:40:36,820 Is that right? 743 00:40:36,820 --> 00:40:39,550 It does have a ti [INAUDIBLE],, not a [INAUDIBLE].. 744 00:40:39,550 --> 00:40:40,960 I'll have to double check. 745 00:40:40,960 --> 00:40:43,190 Possibly including delta t. 746 00:40:43,190 --> 00:40:45,050 I can't remember. 747 00:40:45,050 --> 00:40:47,800 All right. 748 00:40:47,800 --> 00:40:51,760 But the integrals are very analytical, 749 00:40:51,760 --> 00:40:54,490 and only certain ones are non-zero. 750 00:40:54,490 --> 00:41:00,790 So only one that the two is when the two is differ by one unit, 751 00:41:00,790 --> 00:41:02,260 do they have a non-zero integral? 752 00:41:02,260 --> 00:41:03,718 All the rest of them are non-zeros. 753 00:41:03,718 --> 00:41:05,350 So, when I write down these equations, 754 00:41:05,350 --> 00:41:07,414 I mean, many, many, many, many zeros, 755 00:41:07,414 --> 00:41:09,580 so it looks horrible when I write Galerkin's method, 756 00:41:09,580 --> 00:41:11,871 I get so many integrals, but actually a zillion of them 757 00:41:11,871 --> 00:41:15,550 are zero, and then there's a bunch of special tricks 758 00:41:15,550 --> 00:41:19,900 I can do that make it even better than that. 759 00:41:19,900 --> 00:41:22,210 OK? 760 00:41:22,210 --> 00:41:23,810 So then, the Jacobian sparse. 761 00:41:23,810 --> 00:41:27,130 So, that'll save you a lot of time in linear algebra, which 762 00:41:27,130 --> 00:41:28,575 allows you use a lot of points. 763 00:41:28,575 --> 00:41:31,585 So, you can use a very large basis set because you end up 764 00:41:31,585 --> 00:41:33,210 with sparse Jacobians, I mean, it's not 765 00:41:33,210 --> 00:41:35,350 going to fill your memory storing all the elements 766 00:41:35,350 --> 00:41:38,270 in the Jacobian, even if the number of points is very large. 767 00:41:38,270 --> 00:41:42,930 And also, there's vast numerical solution methods for those. 768 00:41:42,930 --> 00:41:46,650 So that's the idea of this. 769 00:41:46,650 --> 00:41:49,800 I guess should we try to carry one of these out? 770 00:41:49,800 --> 00:41:52,050 You guys are [INAUDIBLE] trying to do a lot of algebra 771 00:41:52,050 --> 00:41:53,124 on the board? 772 00:41:53,124 --> 00:41:55,520 Do you think I can do the algebra on the board? 773 00:41:55,520 --> 00:41:57,710 That's the real question. 774 00:41:57,710 --> 00:41:58,210 All right. 775 00:42:22,907 --> 00:42:24,490 Should I do it for collocation, or you 776 00:42:24,490 --> 00:42:27,390 guys confident you can do collocation? 777 00:42:27,390 --> 00:42:30,292 You're all right with collocation? 778 00:42:30,292 --> 00:42:31,500 You're fine with collocation. 779 00:42:31,500 --> 00:42:32,290 Great. 780 00:42:32,290 --> 00:42:33,200 OK. 781 00:42:33,200 --> 00:42:36,320 So we'll just go right into Galerkin. 782 00:42:36,320 --> 00:42:38,076 So, Galerkin. 783 00:42:38,076 --> 00:42:39,605 That way, we use a local basis. 784 00:42:45,860 --> 00:42:50,450 So, most of the equations we have to solve are this type. 785 00:42:50,450 --> 00:43:05,720 Phi j t times the residual function of summation [? dnk ?] 786 00:43:05,720 --> 00:43:06,833 phi k prime. 787 00:43:12,990 --> 00:43:21,720 Summation [? dnk ?] of phi k and t. 788 00:43:21,720 --> 00:43:22,540 Is equal to zero. 789 00:43:22,540 --> 00:43:24,540 All right, we have a lot of equations like that. 790 00:43:24,540 --> 00:43:26,610 We're trying to find the d's that 791 00:43:26,610 --> 00:43:30,760 are going to force all these integrals to be zero. 792 00:43:30,760 --> 00:43:31,260 OK? 793 00:43:31,260 --> 00:43:35,290 So we have a lot of different j's we're going to try. 794 00:43:35,290 --> 00:43:38,430 We want this to be true for all the n's. 795 00:43:38,430 --> 00:43:41,580 And then we're going to adjust these [? dnk's ?] to try 796 00:43:41,580 --> 00:43:44,260 to force this to be zero. 797 00:43:44,260 --> 00:43:44,760 All right? 798 00:43:44,760 --> 00:43:45,920 That's the main problem. 799 00:43:45,920 --> 00:43:47,294 And then, on top of this, there's 800 00:43:47,294 --> 00:43:49,054 some equations with boundary conditions. 801 00:43:52,330 --> 00:43:56,600 So, now we have to look at what the form is. 802 00:43:56,600 --> 00:44:01,380 If the form is, oh, I erased it, if I can make this explicit 803 00:44:01,380 --> 00:44:05,640 in the derivatives, which I can do very often, 804 00:44:05,640 --> 00:44:16,210 for example, this could be dyn/dt minus [? fm. ?] 805 00:44:16,210 --> 00:44:20,800 So then, dyn/dt is just this. 806 00:44:20,800 --> 00:44:23,300 And then I'll have another term, [? fm, ?] which will depend 807 00:44:23,300 --> 00:44:25,890 on that [INAUDIBLE]. 808 00:44:25,890 --> 00:44:31,380 And so the integral phi j, and I'll just 809 00:44:31,380 --> 00:44:43,170 remind you that phi j is not equal to zero. 810 00:44:43,170 --> 00:44:52,821 If tj minus 1 is less than tj plus 1. 811 00:44:52,821 --> 00:44:53,320 All right. 812 00:44:53,320 --> 00:44:56,290 That's the only places where my local basis 813 00:44:56,290 --> 00:44:58,040 function is non-zero. 814 00:44:58,040 --> 00:44:59,660 That's where the tent is. 815 00:44:59,660 --> 00:45:01,790 And all the rest of it's zero. 816 00:45:01,790 --> 00:45:03,920 So when I have this integral, originally have it 817 00:45:03,920 --> 00:45:07,680 t0 to t-final, but actually I could replace 818 00:45:07,680 --> 00:45:12,466 this with tj minus 1 to tj. 819 00:45:12,466 --> 00:45:13,840 And it's just the same. 820 00:45:13,840 --> 00:45:16,330 Because of all the integral outside that domain is zero. 821 00:45:16,330 --> 00:45:18,460 Because this function is zero. 822 00:45:18,460 --> 00:45:18,970 All right? 823 00:45:18,970 --> 00:45:20,636 So at least I have a small little domain 824 00:45:20,636 --> 00:45:22,577 to do the integral over. 825 00:45:22,577 --> 00:45:25,815 AUDIENCE: [INAUDIBLE] tj? 826 00:45:25,815 --> 00:45:26,690 PROFESSOR: tj plus 1. 827 00:45:26,690 --> 00:45:28,370 Thank you. 828 00:45:28,370 --> 00:45:28,955 Yes. 829 00:45:28,955 --> 00:45:29,460 Yes. 830 00:45:29,460 --> 00:45:29,960 Plus 1. 831 00:45:29,960 --> 00:45:31,696 Yes. 832 00:45:31,696 --> 00:45:34,160 Is that all right? 833 00:45:34,160 --> 00:45:34,870 OK. 834 00:45:34,870 --> 00:45:36,550 So, I have this integral, and then 835 00:45:36,550 --> 00:45:43,005 I have this times the derivative term, so it's dnk 836 00:45:43,005 --> 00:45:50,792 dk prime minus the same integral, j minus 1. 837 00:45:50,792 --> 00:45:52,480 J plus 1. 838 00:45:52,480 --> 00:46:01,348 Phi j sorry [? fm ?] [INAUDIBLE] summation of dn. 839 00:46:01,348 --> 00:46:03,828 k phi. 840 00:46:03,828 --> 00:46:05,316 k [INAUDIBLE] t. 841 00:46:11,264 --> 00:46:11,764 OK. 842 00:46:14,740 --> 00:46:21,395 Now, this derivative of phi k, well, I just 843 00:46:21,395 --> 00:46:22,270 told you what it was. 844 00:46:22,270 --> 00:46:25,330 It's just like the [INAUDIBLE] set functions. 845 00:46:25,330 --> 00:46:28,600 So, this integral, you'll know analytically. 846 00:46:28,600 --> 00:46:32,590 Like, it's either 0 or it's 1/2. 847 00:46:32,590 --> 00:46:34,090 Maybe minus 1/2. 848 00:46:34,090 --> 00:46:35,920 Whatever, but it's nothing complicated, 849 00:46:35,920 --> 00:46:37,670 and you'll just know it right off the bat. 850 00:46:37,670 --> 00:46:40,300 So this is all that can be known. 851 00:46:40,300 --> 00:46:41,260 And sparse. 852 00:46:41,260 --> 00:46:45,517 It's only going to be when k is equal to j minus 1 or j plus 1 853 00:46:45,517 --> 00:46:47,600 that this will be non-zero, and all the rest of it 854 00:46:47,600 --> 00:46:49,424 would be zero. 855 00:46:49,424 --> 00:46:50,380 OK? 856 00:46:50,380 --> 00:46:52,600 So, that's mostly zeros. 857 00:46:52,600 --> 00:46:56,850 This one over here, in principle, 858 00:46:56,850 --> 00:47:00,511 I have quite a huge sum here, k equals 1 to k, 859 00:47:00,511 --> 00:47:02,010 where I have all my basis functions, 860 00:47:02,010 --> 00:47:05,610 which is all my points where I put my little tents down. 861 00:47:05,610 --> 00:47:09,010 So I have a domain and I've parked a lot of tents 862 00:47:09,010 --> 00:47:11,310 all on the domain, that's my basis functions. 863 00:47:11,310 --> 00:47:12,060 And I'm trying to figure out, sort of, 864 00:47:12,060 --> 00:47:13,635 how high the tent poles are. 865 00:47:13,635 --> 00:47:15,350 On all those tents. 866 00:47:15,350 --> 00:47:17,920 And my tunnel functions, the sum of all the heights of those 867 00:47:17,920 --> 00:47:18,669 tents. 868 00:47:18,669 --> 00:47:19,168 OK? 869 00:47:21,720 --> 00:47:25,770 But this guy is only non-zero in this little domain, 870 00:47:25,770 --> 00:47:30,766 and these guys, most of them are zero in that domain, 871 00:47:30,766 --> 00:47:33,140 because they're mostly tents that are far away from where 872 00:47:33,140 --> 00:47:35,440 my special tent phi j is. 873 00:47:35,440 --> 00:47:37,990 OK, so I'm going to draw a picture. 874 00:47:37,990 --> 00:47:43,730 Here's the domain from t0 to t-final. 875 00:47:43,730 --> 00:47:47,060 Over here is my tent corresponding to phi j, 876 00:47:47,060 --> 00:47:50,590 which is centered around tj. 877 00:47:50,590 --> 00:47:52,780 Hence, this function. 878 00:47:52,780 --> 00:47:55,280 And then, these guys are all the other tents. 879 00:47:55,280 --> 00:47:57,350 There's a tent here, there's a tent like this, 880 00:47:57,350 --> 00:47:59,641 there's another tent like this, another tent like this. 881 00:47:59,641 --> 00:48:00,556 All these tents. 882 00:48:00,556 --> 00:48:01,930 Those are all the basis functions 883 00:48:01,930 --> 00:48:05,020 starting from k equals 1 and going up. 884 00:48:05,020 --> 00:48:08,400 All of these guys are zero in this domain because they all 885 00:48:08,400 --> 00:48:10,440 have zero tail. 886 00:48:10,440 --> 00:48:14,070 So, almost all of these, the f's doesn't really 887 00:48:14,070 --> 00:48:15,840 pick up anything from any of those guys 888 00:48:15,840 --> 00:48:17,080 in the domain I care about. 889 00:48:17,080 --> 00:48:19,830 The only domain I care about is this domain right here. 890 00:48:19,830 --> 00:48:24,080 And this whole sum is all zero except for a few special k's 891 00:48:24,080 --> 00:48:28,830 when k is equal to j minus 1, j, or j plus 1. 892 00:48:28,830 --> 00:48:31,182 So I only have to worry about three terms. 893 00:48:31,182 --> 00:48:34,900 The inside contributing to the y in the region of t 894 00:48:34,900 --> 00:48:36,893 that I care about. 895 00:48:36,893 --> 00:48:38,820 All right? 896 00:48:38,820 --> 00:48:44,850 So, when I want to compute the Jacobian with respect 897 00:48:44,850 --> 00:48:49,540 to d, the only terms here where the Jacobian's going 898 00:48:49,540 --> 00:48:59,350 to be non-zero are for d I have a Jacobian, which 899 00:48:59,350 --> 00:49:05,190 is the derivative of this whole thing, ddd nk. 900 00:49:05,190 --> 00:49:06,140 Right? 901 00:49:06,140 --> 00:49:17,955 And that's only non-zero if k is equal to j minus 1 j, 902 00:49:17,955 --> 00:49:19,440 or j plus 1. 903 00:49:23,400 --> 00:49:27,017 You guys see that? 904 00:49:27,017 --> 00:49:28,350 How many people do not see this? 905 00:49:31,722 --> 00:49:32,805 How many people are lying? 906 00:49:36,300 --> 00:49:40,130 This is a really important concept for the locality, 907 00:49:40,130 --> 00:49:41,880 so this is the advantage of a local basis, 908 00:49:41,880 --> 00:49:43,421 that the Jacobian will turn out to be 909 00:49:43,421 --> 00:49:46,830 really sparse because it's only non-zero in this special case. 910 00:49:46,830 --> 00:49:50,660 And you might have 1,000 points, 1,000 911 00:49:50,660 --> 00:49:53,740 of these little tent, 1,000 basis functions in the sum. 912 00:49:53,740 --> 00:49:55,782 But only three of them are non-zero. 913 00:49:55,782 --> 00:49:58,610 For four each n. 914 00:49:58,610 --> 00:50:00,490 So, actually, it's 3 times n. 915 00:50:00,490 --> 00:50:03,180 [INAUDIBLE] non-zero. 916 00:50:03,180 --> 00:50:04,720 Is that all right? 917 00:50:04,720 --> 00:50:07,210 Because it just depends on the k. 918 00:50:07,210 --> 00:50:09,050 Three of the ks are non-zero. 919 00:50:09,050 --> 00:50:11,954 There's 1,000 of these guys [INAUDIBLE].. 920 00:50:11,954 --> 00:50:13,790 Yep. 921 00:50:13,790 --> 00:50:17,000 So that's the big trick of locality. 922 00:50:17,000 --> 00:50:19,250 And then, also, because these integration ranges 923 00:50:19,250 --> 00:50:22,220 are so small, because you choose your points really finely 924 00:50:22,220 --> 00:50:25,670 spaced, then you might get away with simple polynomial 925 00:50:25,670 --> 00:50:29,176 expansions of f, for example. 926 00:50:29,176 --> 00:50:31,050 Around the points, or [INAUDIBLE] expansions, 927 00:50:31,050 --> 00:50:32,610 there are all kinds of little tricks. 928 00:50:32,610 --> 00:50:35,910 Or you could even do quadrature and determine some points, 929 00:50:35,910 --> 00:50:38,682 do a [INAUDIBLE] quadrature to evaluate the integral. 930 00:50:38,682 --> 00:50:40,682 But you only need a few points, because you know 931 00:50:40,682 --> 00:50:43,570 it's a little tiny range of dt. 932 00:50:43,570 --> 00:50:46,870 And you would hope that you've chosen so many fees, so 933 00:50:46,870 --> 00:50:49,690 many time points, that your function doesn't 934 00:50:49,690 --> 00:50:52,450 change much from one time point to the next. 935 00:50:52,450 --> 00:50:55,409 So, more or less, first order is constant. 936 00:50:55,409 --> 00:50:56,950 Your function's constant with respect 937 00:50:56,950 --> 00:50:59,710 to t in this little tiny domain, and then maybe 938 00:50:59,710 --> 00:51:00,850 has a little slope. 939 00:51:00,850 --> 00:51:02,520 And then, if you're really being fancy, 940 00:51:02,520 --> 00:51:04,270 you might be able to put a parabola on it. 941 00:51:04,270 --> 00:51:05,440 But it's not going to change that much. 942 00:51:05,440 --> 00:51:07,330 If it's changing a lot, that's telling you 943 00:51:07,330 --> 00:51:08,705 you don't have enough time points 944 00:51:08,705 --> 00:51:11,274 and you should go back and put some more basis functions in. 945 00:51:11,274 --> 00:51:12,550 And then you can get a good [INAUDIBLE].. 946 00:51:12,550 --> 00:51:14,091 Because what we're, really doing here 947 00:51:14,091 --> 00:51:16,240 is we're using this basis set. 948 00:51:16,240 --> 00:51:18,970 If I add up these guys, what I'm really doing 949 00:51:18,970 --> 00:51:21,040 is piecewise linear interpolation 950 00:51:21,040 --> 00:51:22,900 between all the points. 951 00:51:22,900 --> 00:51:28,512 So I'm approximating my y versus time. 952 00:51:28,512 --> 00:51:29,720 It's going to look like this. 953 00:51:37,390 --> 00:51:37,890 All right. 954 00:51:37,890 --> 00:51:39,910 It's piecewise linear, because that's 955 00:51:39,910 --> 00:51:41,660 the only thing you can make from adding up 956 00:51:41,660 --> 00:51:43,100 a bunch of straight line segments. 957 00:51:43,100 --> 00:51:45,080 A bunch of tents is a bunch of straight lines. 958 00:51:45,080 --> 00:51:48,410 And so this is what the approximate function is. 959 00:51:48,410 --> 00:51:50,390 Well, you can see, this is really bad 960 00:51:50,390 --> 00:51:52,050 if these functions are too different from each other. 961 00:51:52,050 --> 00:51:53,300 But if they're all like this-- 962 00:52:01,292 --> 00:52:02,750 and you think, well, maybe it's not 963 00:52:02,750 --> 00:52:05,310 so bad to use piecewise linear. 964 00:52:05,310 --> 00:52:06,024 Yeah. 965 00:52:06,024 --> 00:52:09,190 AUDIENCE: [INAUDIBLE] confused at where 966 00:52:09,190 --> 00:52:11,900 we're using [INAUDIBLE]. 967 00:52:12,440 --> 00:52:13,981 PROFESSOR: Inside [? f ?] solve, what 968 00:52:13,981 --> 00:52:16,760 is trying to solve for the d's, it's 969 00:52:16,760 --> 00:52:21,270 solving each of this giant set of the equations, a whole lot 970 00:52:21,270 --> 00:52:25,840 of equations like this, they all come in to a gigantic f. 971 00:52:25,840 --> 00:52:28,914 That's the f of d that need to make equal to to zero. 972 00:52:28,914 --> 00:52:30,330 And so, I'm [? burying ?] the d's, 973 00:52:30,330 --> 00:52:32,780 I need the Jacobian of that gigantic f. 974 00:52:32,780 --> 00:52:35,390 Now, the problem, because it's gigantic, 975 00:52:35,390 --> 00:52:38,630 I need a lot of points, a lot of closely spaced points 976 00:52:38,630 --> 00:52:40,700 to make my function look smooth. 977 00:52:40,700 --> 00:52:43,500 That means the number of base functions is really huge. 978 00:52:43,500 --> 00:52:47,180 So the Jacobian principle is huge number squared. 979 00:52:47,180 --> 00:52:50,510 I have 1,000 points, say, discretizing my domain. 980 00:52:50,510 --> 00:52:52,176 And then it's 1,000 by 1,000 Jacobian. 981 00:52:52,176 --> 00:52:54,800 It might be really hard to solve it, or cost a lot of CPU time, 982 00:52:54,800 --> 00:52:56,180 or use a lot of memory. 983 00:52:56,180 --> 00:52:58,940 But, fortunately, almost all the elements are zero. 984 00:52:58,940 --> 00:53:03,130 So, it's like, has a sparsity of 0.3% or something 985 00:53:03,130 --> 00:53:05,030 is the occupancy. 986 00:53:05,030 --> 00:53:06,770 So, it's almost all completely sparse, 987 00:53:06,770 --> 00:53:10,560 and therefore you can solve it even though it's gigantic. 988 00:53:10,560 --> 00:53:11,750 Yes. 989 00:53:11,750 --> 00:53:16,170 AUDIENCE: [INAUDIBLE] basis function [INAUDIBLE] 990 00:53:16,170 --> 00:53:24,104 the Jacobian [INAUDIBLE] should be [INAUDIBLE] 991 00:53:24,104 --> 00:53:25,520 PROFESSOR: We're trying to find d, 992 00:53:25,520 --> 00:53:29,800 so we're really trying to solve a problem that's 993 00:53:29,800 --> 00:53:34,440 f of d is equal to zero. 994 00:53:34,440 --> 00:53:37,060 That's our fundamental problem we're trying to solve. 995 00:53:37,060 --> 00:53:38,490 We're doing Galerkin. 996 00:53:38,490 --> 00:53:40,745 We have something equal to zero, and it depends on d. 997 00:53:40,745 --> 00:53:42,120 And we're trying to find the d's. 998 00:53:42,120 --> 00:53:44,660 So this is really the function we're trying to solve. 999 00:53:44,660 --> 00:53:46,410 In order to evaluate the elements in this, 1000 00:53:46,410 --> 00:53:48,000 we have to compute a whole bunch of integrals 1001 00:53:48,000 --> 00:53:49,041 with the Galerkin method. 1002 00:53:49,041 --> 00:53:50,452 So that's the complexity. 1003 00:53:50,452 --> 00:53:52,410 But the basis functions, we know what they are. 1004 00:53:52,410 --> 00:53:54,360 We've pre-specified them. 1005 00:53:54,360 --> 00:53:57,560 So, the whole question is just what the d's are. 1006 00:53:57,560 --> 00:54:01,830 And the d's get multiplied by a whole lot of integrals. 1007 00:54:01,830 --> 00:54:03,200 Is this all right? 1008 00:54:03,200 --> 00:54:06,112 I think I may have misunderstood the question. 1009 00:54:06,112 --> 00:54:07,570 So you have f of d is [INAUDIBLE],, 1010 00:54:07,570 --> 00:54:10,400 so therefore we probably want to know j with respect to d. 1011 00:54:15,080 --> 00:54:16,980 OK. 1012 00:54:16,980 --> 00:54:19,980 Time ran out before clarity was achieved. 1013 00:54:19,980 --> 00:54:22,890 We'll try to achieve clarity on Wednesday morning.