1 00:00:01,580 --> 00:00:03,920 The following content is provided under a Creative 2 00:00:03,920 --> 00:00:05,340 Commons license. 3 00:00:05,340 --> 00:00:07,550 Your support will help MIT OpenCourseWare 4 00:00:07,550 --> 00:00:11,640 continue to offer high quality educational resources for free. 5 00:00:11,640 --> 00:00:14,180 To make a donation, or to view additional materials 6 00:00:14,180 --> 00:00:18,110 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:18,110 --> 00:00:19,340 at ocw.mit.edu. 8 00:00:24,530 --> 00:00:27,120 PROFESSOR: All right, let's get started. 9 00:00:27,120 --> 00:00:31,190 So today we're going to talk about boundary value problems. 10 00:00:31,190 --> 00:00:34,295 But I want to try to start back with a motivating example. 11 00:00:37,700 --> 00:00:41,030 So unfortunately, like most technologies, 12 00:00:41,030 --> 00:00:45,540 the biggest driver for differential equation solutions 13 00:00:45,540 --> 00:00:48,890 was from military technology. 14 00:00:48,890 --> 00:00:51,987 And the military problem-- 15 00:00:51,987 --> 00:00:53,070 I'll tell you in a second. 16 00:00:53,070 --> 00:00:54,080 Let me first remind you. 17 00:00:54,080 --> 00:00:55,325 So we have ODE-IVPs. 18 00:01:00,460 --> 00:01:21,010 And they are-- right. 19 00:01:21,010 --> 00:01:25,610 So that's the ODE-IVP is we have n differential equations, 20 00:01:25,610 --> 00:01:28,186 and we have n initial conditions. 21 00:01:28,186 --> 00:01:29,935 And you guys are really good at these now. 22 00:01:29,935 --> 00:01:30,955 Had a lot of practice. 23 00:01:33,760 --> 00:01:37,240 But you can have problems where some of the conditions 24 00:01:37,240 --> 00:01:41,830 are not specified at the t0. 25 00:01:41,830 --> 00:01:43,340 They are specified somewhere else. 26 00:01:43,340 --> 00:01:48,220 So if all of them are specified at t0, we call it an IVP. 27 00:01:48,220 --> 00:01:55,840 And we call it a BVP is if the conditions are like this. 28 00:02:02,410 --> 00:02:04,057 This is not so good. 29 00:02:09,449 --> 00:02:11,610 And not all the tm's are the same. 30 00:02:11,610 --> 00:02:14,700 If all the tm's are the same, we call it t0, 31 00:02:14,700 --> 00:02:15,960 and we're back to IVP. 32 00:02:15,960 --> 00:02:21,630 So IVP is like a special case of the ODE-BVP problem. 33 00:02:21,630 --> 00:02:24,280 And here I'm ranking them as if everything is explicit. 34 00:02:24,280 --> 00:02:27,210 So we know an explicit equation for dy dt. 35 00:02:27,210 --> 00:02:30,540 We have an explicit equation for the boundary conditions. 36 00:02:30,540 --> 00:02:34,590 In fact, often, we actually only have implicit equations. 37 00:02:34,590 --> 00:02:37,595 So I'll show you an example in a minute. 38 00:02:37,595 --> 00:02:38,730 But that's it. 39 00:02:38,730 --> 00:02:44,520 And we still need to have n equations. 40 00:02:44,520 --> 00:02:45,810 Well, I guess I could do this. 41 00:02:45,810 --> 00:02:48,100 Take this back. 42 00:02:48,100 --> 00:02:50,970 Basic goals, and just be just be careful. 43 00:02:50,970 --> 00:02:53,152 These ends are-- it's the same number of them. 44 00:02:53,152 --> 00:02:54,610 It's the same number of conditions. 45 00:02:54,610 --> 00:02:57,550 This is OK to write it this way, but just be careful. 46 00:03:01,230 --> 00:03:02,090 Is that OK? 47 00:03:02,090 --> 00:03:03,430 Just to make it confusing. 48 00:03:03,430 --> 00:03:04,500 All right. 49 00:03:04,500 --> 00:03:06,067 I guess I can call this 0 now. 50 00:03:06,067 --> 00:03:07,650 See, but now it's not really 0, right? 51 00:03:07,650 --> 00:03:11,412 It's really maybe-- call it star at the boundary. 52 00:03:11,412 --> 00:03:13,370 There's some special value-- some special place 53 00:03:13,370 --> 00:03:15,300 where you know the value of y. 54 00:03:18,120 --> 00:03:18,620 All right. 55 00:03:21,382 --> 00:03:23,090 So let's do the motivating example, which 56 00:03:23,090 --> 00:03:25,420 comes from military technology. 57 00:03:25,420 --> 00:03:27,600 And this is quite an old problem. 58 00:03:27,600 --> 00:03:30,040 So, because, in the old days, people 59 00:03:30,040 --> 00:03:33,296 didn't have motor vehicles, and, basically, the roads 60 00:03:33,296 --> 00:03:35,170 were no good, and there were a lot of bandits 61 00:03:35,170 --> 00:03:38,620 out on the roads, people liked to ship everything 62 00:03:38,620 --> 00:03:41,390 by water transportation. 63 00:03:41,390 --> 00:03:45,550 And so all the towns grew up on rivers, 64 00:03:45,550 --> 00:03:48,370 or on ports on the ocean. 65 00:03:48,370 --> 00:03:52,130 And so, if you lived in a nice little town, 66 00:03:52,130 --> 00:03:54,090 you know, up in the hills there, and then, 67 00:03:54,090 --> 00:03:56,470 at the base of the hills, you have your cute little town. 68 00:03:56,470 --> 00:03:57,860 You have your house. 69 00:03:57,860 --> 00:04:02,080 You have some warehouses where you keep all your nice goods. 70 00:04:02,080 --> 00:04:08,620 You have a dock that goes out onto the water. 71 00:04:08,620 --> 00:04:10,249 Here's the land. 72 00:04:10,249 --> 00:04:12,290 Here, these nice ships come and park at the dock. 73 00:04:12,290 --> 00:04:13,850 They unload nice goods. 74 00:04:13,850 --> 00:04:15,380 You trade your stuff to them. 75 00:04:15,380 --> 00:04:17,045 You make a lot of money. 76 00:04:17,045 --> 00:04:19,670 Everyone's happy and prosperous and having a great time living. 77 00:04:19,670 --> 00:04:21,290 This is a port city. 78 00:04:21,290 --> 00:04:27,080 But then you look out on the horizon in the water, 79 00:04:27,080 --> 00:04:28,892 and you see a ship is coming. 80 00:04:28,892 --> 00:04:30,350 And sometimes that a ship is coming 81 00:04:30,350 --> 00:04:31,516 is really good news for you. 82 00:04:34,570 --> 00:04:37,915 But sometimes the ship coming is not good because on the back, 83 00:04:37,915 --> 00:04:49,300 it has a flag, and on the flag, you see skull and crossbones. 84 00:04:49,300 --> 00:04:51,940 And you realize it's a pirate ship coming. 85 00:04:51,940 --> 00:04:54,499 And now you're in serious trouble 86 00:04:54,499 --> 00:04:56,540 because you really don't want the pirates to come 87 00:04:56,540 --> 00:04:58,580 to your nice little town because who 88 00:04:58,580 --> 00:05:00,140 knows what they'll do there. 89 00:05:00,140 --> 00:05:02,000 But it won't be good. 90 00:05:02,000 --> 00:05:04,170 All right, so the people who live in this town, 91 00:05:04,170 --> 00:05:06,950 after this has happened to you a few times, 92 00:05:06,950 --> 00:05:09,260 you're really alarmed, and you're really happy, 93 00:05:09,260 --> 00:05:10,570 and you don't want to rebuild your town again 94 00:05:10,570 --> 00:05:11,960 because it just got burned down the last time 95 00:05:11,960 --> 00:05:14,293 and the pirate came and pillaged it and took everything. 96 00:05:14,293 --> 00:05:16,520 And you guys all had to run away into the hills. 97 00:05:16,520 --> 00:05:19,820 So instead, they've invented cannons or catapults, put 98 00:05:19,820 --> 00:05:22,790 one of the cannons, say, at the top of the hill 99 00:05:22,790 --> 00:05:24,079 above your town. 100 00:05:24,079 --> 00:05:26,120 And then you say, the next time the pirates come, 101 00:05:26,120 --> 00:05:27,640 I'm ready for them. 102 00:05:27,640 --> 00:05:29,210 So drawing the cannon. 103 00:05:32,120 --> 00:05:37,370 And so the question is, you want to shoot the cannonball so it 104 00:05:37,370 --> 00:05:40,160 hit the pirate ship at the waterline, 105 00:05:40,160 --> 00:05:44,740 when the pirate is distance L from the shore-- 106 00:05:44,740 --> 00:05:46,537 hopefully, pretty far, so they're 107 00:05:46,537 --> 00:05:47,870 not going to shoot at you first. 108 00:05:47,870 --> 00:05:49,150 And you're shooting from up at the top of the hill, 109 00:05:49,150 --> 00:05:51,160 so you can shoot further than they can. 110 00:05:51,160 --> 00:05:53,270 So you're going to shoot distance L. And you're 111 00:05:53,270 --> 00:05:57,400 shooting from an elevation H. And you 112 00:05:57,400 --> 00:06:00,042 want to make sure your cannonball hits them, ideally, 113 00:06:00,042 --> 00:06:01,000 right at the waterline. 114 00:06:01,000 --> 00:06:04,960 Boom, makes a nice hole in their ship, and it sinks. 115 00:06:04,960 --> 00:06:07,120 So that's the plan. 116 00:06:07,120 --> 00:06:11,360 Now the problem is, getting the cannonball 117 00:06:11,360 --> 00:06:15,870 to go from here to there is not so easy. 118 00:06:15,870 --> 00:06:16,980 It's a big ocean. 119 00:06:16,980 --> 00:06:18,140 There's a lot of places your cannonballs can 120 00:06:18,140 --> 00:06:19,681 fall into the ocean, and it might not 121 00:06:19,681 --> 00:06:21,060 be where the pirate ship is. 122 00:06:21,060 --> 00:06:24,690 And reloading canon is pretty slow. 123 00:06:24,690 --> 00:06:26,440 And you guys live in this prosperous port. 124 00:06:26,440 --> 00:06:27,940 You're not military guys, and so you 125 00:06:27,940 --> 00:06:29,960 don't have that much practice doing it anyway. 126 00:06:29,960 --> 00:06:31,710 And you're cheap because you're merchants. 127 00:06:31,710 --> 00:06:32,910 And you don't want to spend your money buying 128 00:06:32,910 --> 00:06:34,205 lots of cannonballs anyway. 129 00:06:34,205 --> 00:06:36,080 So you only get a few of cannonballs up here. 130 00:06:36,080 --> 00:06:39,304 And there's a little pile of cannonballs next to the cannon. 131 00:06:39,304 --> 00:06:41,220 And then, when you see the pirate ship coming, 132 00:06:41,220 --> 00:06:43,230 you guys run up the hill quick, and you 133 00:06:43,230 --> 00:06:45,190 get to take a couple of shots, and that's it. 134 00:06:45,190 --> 00:06:47,700 And if you hit them, then your town is safe, 135 00:06:47,700 --> 00:06:50,550 and, otherwise, everything you love and know in your world 136 00:06:50,550 --> 00:06:53,490 is going to be destroyed by the pirates. 137 00:06:53,490 --> 00:06:55,020 OK? 138 00:06:55,020 --> 00:06:56,880 So this was the motivating sample 139 00:06:56,880 --> 00:06:59,630 for that element of differential equation solvers. 140 00:06:59,630 --> 00:07:00,130 OK? 141 00:07:04,320 --> 00:07:06,886 So let's see if we can write down the equations that 142 00:07:06,886 --> 00:07:08,010 correspond to this example. 143 00:07:12,220 --> 00:07:13,990 So it's going to be Newton's laws. 144 00:07:13,990 --> 00:07:18,520 F equals ma on the cannonball as it travels. 145 00:07:18,520 --> 00:07:25,600 So we can write that also as equals-- well what's the F? 146 00:07:25,600 --> 00:07:35,238 F is going to be negative mg in the z direction. 147 00:07:38,020 --> 00:07:40,270 That's gravity pulling the cannonball down. 148 00:07:40,270 --> 00:07:43,750 And then you'll have some air friction on the cannonball. 149 00:07:43,750 --> 00:07:46,260 And I'm going to call the air friction coefficient gamma m 150 00:07:46,260 --> 00:07:53,160 times v. OK? 151 00:07:53,160 --> 00:07:55,140 So that's the simplest model for what 152 00:07:55,140 --> 00:07:57,610 the forces are on a cannonball just flying from my cannon, 153 00:07:57,610 --> 00:08:00,080 hopefully, to hit the pirate ship. 154 00:08:00,080 --> 00:08:07,085 And I can rearrange us by dividing through by m. 155 00:08:07,085 --> 00:08:14,500 And acceleration is velocity, so dv dt is equal to negative g. 156 00:08:14,500 --> 00:08:16,580 So you have negative gamma-- 157 00:08:21,260 --> 00:08:22,330 sorry. 158 00:08:22,330 --> 00:08:23,946 My notation is not so good. 159 00:08:23,946 --> 00:08:24,446 OK. 160 00:08:27,480 --> 00:08:29,300 Everyone is all right with this? 161 00:08:29,300 --> 00:08:30,050 Yeah. 162 00:08:30,050 --> 00:08:34,410 So then we can write the whole differential equation system, 163 00:08:34,410 --> 00:08:49,720 d dt of xz vx vz equals dx dt is vx, dz dt is vz. 164 00:08:49,720 --> 00:08:53,810 dvx dt is negative gamma vx. 165 00:08:57,120 --> 00:09:02,740 dvz dt is negative g minus gamma v ez. 166 00:09:06,820 --> 00:09:08,635 So that's a fine ODE system. 167 00:09:08,635 --> 00:09:09,760 It's not too hard to solve. 168 00:09:09,760 --> 00:09:10,635 It's actually linear. 169 00:09:10,635 --> 00:09:12,157 It's a piece of cake, right? 170 00:09:12,157 --> 00:09:13,990 You guys just probably just did this already 171 00:09:13,990 --> 00:09:16,448 when you were in high school, or college, anyway, for sure. 172 00:09:18,800 --> 00:09:24,230 And let's write down the initial conditions. 173 00:09:24,230 --> 00:09:30,760 So we know x0 is equal to 0. 174 00:09:30,760 --> 00:09:38,290 z of 0 is equal to h, the height of the canon. 175 00:09:38,290 --> 00:09:41,340 vx of 0, oh, what's that equal to? 176 00:09:41,340 --> 00:09:44,200 We don't know. vz of 0, we don't know that either. 177 00:09:47,300 --> 00:09:51,200 But we bought this canon with a certified muzzle velocity v0, 178 00:09:51,200 --> 00:09:54,410 so we actually know that vx of 0 squared 179 00:09:54,410 --> 00:10:01,760 plus the vz of 0 squared is equal to v0 squared-- 180 00:10:01,760 --> 00:10:04,610 whereas, when I bought the canon, 181 00:10:04,610 --> 00:10:06,800 the merchants went out to the local canon dealer 182 00:10:06,800 --> 00:10:08,630 and bought a canon, and the guy said, 183 00:10:08,630 --> 00:10:09,710 you put this much gunpowder in it, 184 00:10:09,710 --> 00:10:11,168 you'll get a muzzle velocity of v0. 185 00:10:11,168 --> 00:10:13,430 So they know that that number is. 186 00:10:13,430 --> 00:10:15,520 So we have a condition that's not really the way 187 00:10:15,520 --> 00:10:16,680 we expect it to be. 188 00:10:16,680 --> 00:10:18,180 And we don't have enough conditions. 189 00:10:18,180 --> 00:10:19,720 We need four conditions. 190 00:10:19,720 --> 00:10:21,610 But of course, the most important condition 191 00:10:21,610 --> 00:10:28,150 is what happens at L. We really want to know that x of t final 192 00:10:28,150 --> 00:10:33,635 is equal to L and y of t final is equal to 0 at sea level. 193 00:10:33,635 --> 00:10:35,260 So that way, our cannonball is going to 194 00:10:35,260 --> 00:10:38,260 into the right location at t final. 195 00:10:38,260 --> 00:10:42,510 So we have two conditions specified way, 196 00:10:42,510 --> 00:10:45,610 way away from where we are. 197 00:10:45,610 --> 00:10:47,794 And we have two conditions specified initially. 198 00:10:47,794 --> 00:10:49,210 And no you have some oddball thing 199 00:10:49,210 --> 00:10:53,600 in here, some oddball fifth condition. 200 00:10:53,600 --> 00:10:56,070 Now, OK. 201 00:10:58,297 --> 00:10:59,880 One problem here is, we don't actually 202 00:10:59,880 --> 00:11:02,422 know what t final is because before we shoot it, 203 00:11:02,422 --> 00:11:04,630 we really don't know how long it takes the cannonball 204 00:11:04,630 --> 00:11:06,250 to get out there. 205 00:11:06,250 --> 00:11:07,990 So this is a kind of weird condition 206 00:11:07,990 --> 00:11:09,775 where t final is unknown, whereas, the ones you've 207 00:11:09,775 --> 00:11:11,816 done before, I think you've always known t final. 208 00:11:11,816 --> 00:11:13,020 Is that right? 209 00:11:13,020 --> 00:11:14,871 So let's talk about how to deal with that. 210 00:11:17,760 --> 00:11:19,770 So one problem, one way to deal with this 211 00:11:19,770 --> 00:11:24,020 is to notice that, if we have an equation system dy dt equals 212 00:11:24,020 --> 00:11:30,172 f of y, we could change variables instead of using t. 213 00:11:30,172 --> 00:11:32,630 Since we really don't know much about time in this problem, 214 00:11:32,630 --> 00:11:34,890 t is not the best variable for us. 215 00:11:34,890 --> 00:11:37,910 So we want to change it to some new variable u. 216 00:11:37,910 --> 00:11:41,790 So suppose that we want to change to u. 217 00:11:41,790 --> 00:11:48,254 And, if we change to u, we can write something 218 00:11:48,254 --> 00:11:56,900 like this-- dy du du dt equals f of y. 219 00:11:56,900 --> 00:11:58,340 Can you see that? 220 00:11:58,340 --> 00:12:00,530 So I can try to get the differentials in terms of u, 221 00:12:00,530 --> 00:12:02,677 and I just have to know what my du dt is. 222 00:12:02,677 --> 00:12:04,760 And you guys might have even changed the variables 223 00:12:04,760 --> 00:12:07,330 before, in calculus sometime, you probably did this-- 224 00:12:07,330 --> 00:12:10,880 a long time ago, and chain rule, and stuff like that. 225 00:12:10,880 --> 00:12:15,500 All right, so we can sort of pick whatever idea we want, 226 00:12:15,500 --> 00:12:17,742 and as long as we put in the du dt in the equation, 227 00:12:17,742 --> 00:12:18,450 then we'll be OK. 228 00:12:21,290 --> 00:12:26,330 So let's just choose that u is equal to x because we know du 229 00:12:26,330 --> 00:12:28,420 dt would then be with the vx. 230 00:12:32,480 --> 00:12:36,850 So we could we could write this out this way. 231 00:12:36,850 --> 00:12:38,890 We could write d-- 232 00:12:38,890 --> 00:12:40,860 I'll keep it as u for a minute, so the notation 233 00:12:40,860 --> 00:12:42,490 won't be so confusing. 234 00:12:42,490 --> 00:12:53,350 So du dt, dy du is equal to f of y over du dt. 235 00:12:53,350 --> 00:12:56,560 And as long as du dt is never zero, we're good. 236 00:12:56,560 --> 00:13:00,370 So we could any u we want as long du dt is never zero. 237 00:13:00,370 --> 00:13:03,670 Then we're still going to have a nice simple question here. 238 00:13:03,670 --> 00:13:08,620 And so I'm going to choose u is equal to x because du dt is vx. 239 00:13:08,620 --> 00:13:10,090 And I know that vx is never zero. 240 00:13:10,090 --> 00:13:13,690 They're kind of also always moving to the right. 241 00:13:13,690 --> 00:13:15,190 So I'm going to divide by something. 242 00:13:15,190 --> 00:13:16,780 It's never zero. 243 00:13:16,780 --> 00:13:19,060 So I can write it this way-- 244 00:13:19,060 --> 00:13:22,700 dy du is equal to-- 245 00:13:22,700 --> 00:13:25,281 I can go down that list and divide each of these things 246 00:13:25,281 --> 00:13:25,780 by vx. 247 00:13:28,850 --> 00:13:38,790 So it's 1, vz over vx, negative gamma, negative g 248 00:13:38,790 --> 00:13:47,160 over vx minus gamma vz over vx. 249 00:13:47,160 --> 00:13:50,690 That's my new [INAUDIBLE]. 250 00:13:50,690 --> 00:13:51,190 OK? 251 00:13:55,620 --> 00:13:57,762 OK with this? 252 00:13:57,762 --> 00:13:58,670 How about energetic? 253 00:13:58,670 --> 00:13:59,030 Keep nodding. 254 00:13:59,030 --> 00:14:00,530 Yeah, yeah, sure, keep going faster. 255 00:14:00,530 --> 00:14:01,580 It's going way too slow. 256 00:14:01,580 --> 00:14:02,850 That's what I want you to say. 257 00:14:02,850 --> 00:14:04,886 Yeah? 258 00:14:04,886 --> 00:14:05,510 Apparently not. 259 00:14:05,510 --> 00:14:06,540 OK. 260 00:14:06,540 --> 00:14:07,040 All right. 261 00:14:10,040 --> 00:14:15,020 So the advantage to changing here 262 00:14:15,020 --> 00:14:17,690 is that now I can write the initial conditions, and all 263 00:14:17,690 --> 00:14:23,050 these conditions, in terms of u, which is x. 264 00:14:23,050 --> 00:14:28,030 So I really-- I want to go from u is equal to 0, i.e. 265 00:14:28,030 --> 00:14:35,100 X is equals to 0, to u is equal to L, which is x equal to L. 266 00:14:35,100 --> 00:14:37,680 So now, I could also look at this say, 267 00:14:37,680 --> 00:14:41,160 this is kind of stupid. dy du, the first component of y 268 00:14:41,160 --> 00:14:43,620 is dy du is equal to one. 269 00:14:43,620 --> 00:14:45,390 And that first component of y never 270 00:14:45,390 --> 00:14:48,040 appears in the rest of these equations. 271 00:14:48,040 --> 00:14:50,580 So that's kind of not a very useful one. 272 00:14:50,580 --> 00:14:55,530 So I can change, and I could write a simpler equation, 273 00:14:55,530 --> 00:15:07,300 dy tilde du is equal to vz over vx negative gamma, negative g 274 00:15:07,300 --> 00:15:15,430 over vx minus gamma vz over vx, where 275 00:15:15,430 --> 00:15:21,130 my y tilde is just equal to the last three variables-- 276 00:15:21,130 --> 00:15:25,521 z, vx, vz. 277 00:15:30,492 --> 00:15:32,200 So I did a lot of algebra, but I ended up 278 00:15:32,200 --> 00:15:33,575 simplifying my life because now I 279 00:15:33,575 --> 00:15:37,250 have three different equations to solve instead of four. 280 00:15:37,250 --> 00:15:44,410 And I can write that y tilde of zero 281 00:15:44,410 --> 00:15:48,390 of the first element of y tilde, which is z, is equals to h. 282 00:15:48,390 --> 00:15:51,270 So that's a condition I know for sure. 283 00:15:51,270 --> 00:15:53,580 And I know that I really want this cannonball 284 00:15:53,580 --> 00:15:56,070 to hit the pirate ship. 285 00:15:56,070 --> 00:16:04,550 So I want y1 tilde of L to be 0, so I want tilde as z. 286 00:16:04,550 --> 00:16:09,460 And I want z to be 0 when x is equal to L. 287 00:16:09,460 --> 00:16:11,960 Or that's the point where the cannonball is hitting the ship 288 00:16:11,960 --> 00:16:13,090 at the water line there. 289 00:16:16,490 --> 00:16:19,010 So those are definitely two conditions I have. 290 00:16:19,010 --> 00:16:22,120 And then I need a third condition. 291 00:16:22,120 --> 00:16:24,390 And my third condition is this crazy equation here. 292 00:16:31,960 --> 00:16:34,260 All right, so now I have three conditions 293 00:16:34,260 --> 00:16:36,990 for three differential equations, and one of them 294 00:16:36,990 --> 00:16:38,910 is an oddball looking thing. 295 00:16:38,910 --> 00:16:40,160 These two look kind of normal. 296 00:16:40,160 --> 00:16:42,020 However, this one is a t0, and this one 297 00:16:42,020 --> 00:16:44,805 is some goofball value, but at least I know the value. 298 00:16:44,805 --> 00:16:46,430 I know what L is because I know how far 299 00:16:46,430 --> 00:16:47,429 away the pirate ship is. 300 00:16:50,170 --> 00:16:50,980 So far so good? 301 00:16:53,590 --> 00:16:55,190 All right. 302 00:16:55,190 --> 00:16:57,670 But how am I going to solve this? 303 00:16:57,670 --> 00:17:00,610 So how do we know how to solve differential equations right 304 00:17:00,610 --> 00:17:04,270 now is we know how to do initial value problems. 305 00:17:04,270 --> 00:17:06,740 We have these nice programs like ode45 306 00:17:06,740 --> 00:17:09,219 that work great, integrate differential equations. 307 00:17:09,219 --> 00:17:11,510 So we should be able to use that somehow to solve this. 308 00:17:11,510 --> 00:17:13,540 But we don't have all the inputs because ode45 309 00:17:13,540 --> 00:17:16,940 would expect us to give values of all three of the y 310 00:17:16,940 --> 00:17:19,569 tilde values at 0. 311 00:17:19,569 --> 00:17:20,569 I only know one of them. 312 00:17:23,710 --> 00:17:25,380 So how can I approach it? 313 00:17:28,627 --> 00:17:30,460 Sorry, I'm going to put my beautiful drawing 314 00:17:30,460 --> 00:17:31,126 down below here. 315 00:17:33,129 --> 00:17:35,170 We'll save it for posterity and look at it later. 316 00:17:39,220 --> 00:17:42,860 So I could approach it by saying, well, 317 00:17:42,860 --> 00:17:46,780 I don't know what these two initial conditions would be, 318 00:17:46,780 --> 00:17:50,970 what vx and vz should be at 0. 319 00:17:50,970 --> 00:17:52,780 I'll treat them as unknowns. 320 00:17:52,780 --> 00:17:54,488 I want to figure out what they should be. 321 00:17:56,700 --> 00:18:00,890 And so, I'm going to vary those unknowns 322 00:18:00,890 --> 00:18:03,530 and then, for each value I choose, 323 00:18:03,530 --> 00:18:07,010 then I can shoot the cannon with those v's, and I 324 00:18:07,010 --> 00:18:08,861 can see where the cannonball went, 325 00:18:08,861 --> 00:18:10,610 and if it didn't go to the right location, 326 00:18:10,610 --> 00:18:14,620 I can readjust those v's and then try again. 327 00:18:14,620 --> 00:18:16,370 Just like, if you were running the cannon, 328 00:18:16,370 --> 00:18:18,467 you might shoot at a certain angle, 329 00:18:18,467 --> 00:18:21,050 and then adjust the angle of the cannon, and then shoot again. 330 00:18:21,050 --> 00:18:22,549 And then, when you change the angle, 331 00:18:22,549 --> 00:18:26,120 you change the ratio of vx to vy initially, right? 332 00:18:26,120 --> 00:18:28,320 So that's called the shooting method-- 333 00:18:28,320 --> 00:18:30,670 for good reason. 334 00:18:30,670 --> 00:18:32,650 So the shooting method, that's what we do. 335 00:18:32,650 --> 00:18:51,940 We guess the missing initial conditions, 336 00:18:51,940 --> 00:18:57,270 then you solve using the guess. 337 00:18:57,270 --> 00:19:02,450 You solve the ODE-IVP problem. 338 00:19:07,100 --> 00:19:12,260 And then you see what it computes. 339 00:19:12,260 --> 00:19:14,960 And if the solution you get doesn't 340 00:19:14,960 --> 00:19:17,114 satisfy the conditions you demand, 341 00:19:17,114 --> 00:19:18,530 you go back and adjust your guess. 342 00:19:24,110 --> 00:19:26,749 And you loop around. 343 00:19:26,749 --> 00:19:27,540 So that's the idea. 344 00:19:30,130 --> 00:19:31,720 Now, this thing of adjusting some 345 00:19:31,720 --> 00:19:34,960 parameter values, some initial conditions, 346 00:19:34,960 --> 00:19:37,570 to try to satisfy some condition, that's 347 00:19:37,570 --> 00:19:39,010 like an f solve problem. 348 00:19:39,010 --> 00:19:44,360 That's a system of nonlinear equations kind of problem. 349 00:19:44,360 --> 00:19:48,670 So we're going to have f solve as the outside loop, 350 00:19:48,670 --> 00:19:51,354 and that's going to adjust some parameters. 351 00:19:51,354 --> 00:19:52,520 And then, what's f solve do? 352 00:19:52,520 --> 00:19:56,846 So f solve tries to solve problems of the form g of-- 353 00:19:56,846 --> 00:19:59,296 I usually write x, but I'll call it v here. 354 00:19:59,296 --> 00:19:59,796 No. 355 00:19:59,796 --> 00:20:00,220 V's not good either. 356 00:20:00,220 --> 00:20:02,036 What letter have we have not used yet? 357 00:20:02,036 --> 00:20:03,450 Any letter. 358 00:20:03,450 --> 00:20:04,420 g of w. 359 00:20:04,420 --> 00:20:05,650 There we go. 360 00:20:05,650 --> 00:20:08,020 g of w equals 0. 361 00:20:08,020 --> 00:20:10,280 I want to figure out what w's I need to use. 362 00:20:13,010 --> 00:20:16,700 And actually, v is right. 363 00:20:16,700 --> 00:20:19,100 Because we're trying to adjust the velocities, right? 364 00:20:19,100 --> 00:20:20,550 Sorry, I'm messing up here. 365 00:20:20,550 --> 00:20:22,370 It's good to use the eraser in this class-- 366 00:20:22,370 --> 00:20:25,130 especially with this nice big eraser. 367 00:20:25,130 --> 00:20:27,640 All right, so g of e-- 368 00:20:27,640 --> 00:20:30,960 we're trying to adjust the velocities to make something 0. 369 00:20:30,960 --> 00:20:32,910 So what's our g that we want? 370 00:20:32,910 --> 00:20:41,120 We really want that the z value at L-- 371 00:20:41,120 --> 00:20:44,840 we want that to be equal to 0. 372 00:20:44,840 --> 00:20:47,535 And this thing is, like, implicitly a function 373 00:20:47,535 --> 00:20:48,035 of the v's-- 374 00:20:51,400 --> 00:20:53,390 the v0 values we give. 375 00:20:53,390 --> 00:20:58,520 If you put the right v0 values in, then z at L would be 0. 376 00:20:58,520 --> 00:21:00,680 So this is what we're really trying to solve. 377 00:21:00,680 --> 00:21:04,280 Now, to get z of L, we have to solve a system of differential 378 00:21:04,280 --> 00:21:05,820 equations. 379 00:21:05,820 --> 00:21:08,520 So it's a little complicated to go from v0 to zL, 380 00:21:08,520 --> 00:21:11,090 but we can do because we have ode45. 381 00:21:11,090 --> 00:21:17,125 So we can write a function to do this. 382 00:21:17,125 --> 00:21:18,000 Running out of words. 383 00:21:33,460 --> 00:21:38,020 All right so let's try to write the program. 384 00:21:44,100 --> 00:21:46,740 So we want to write the program g. 385 00:21:46,740 --> 00:22:12,010 So we want to write z of L is equal to g of v0. 386 00:22:16,480 --> 00:22:19,830 And let's try to think what this function is. 387 00:22:19,830 --> 00:22:24,330 So the meat of this is, we have to solve a differential 388 00:22:24,330 --> 00:22:25,890 equation, an IVP. 389 00:22:25,890 --> 00:22:27,390 So somewhere, we have an ode45 call. 390 00:22:30,500 --> 00:22:32,055 And what does ode45 computing? 391 00:22:32,055 --> 00:22:39,450 It's computing the x positions and the z positions. 392 00:22:44,740 --> 00:22:52,670 And it's going to use some function f, which was-- 393 00:22:52,670 --> 00:22:54,920 do we still have it on the board? 394 00:22:54,920 --> 00:22:55,830 Maybe I lost it here. 395 00:22:59,145 --> 00:22:59,645 Nope. 396 00:23:02,872 --> 00:23:03,830 Sorry, it's under here. 397 00:23:03,830 --> 00:23:05,860 I'm a terrible board worker. 398 00:23:05,860 --> 00:23:10,530 So this is our function f, f f of y. 399 00:23:16,250 --> 00:23:22,870 So this is really f tilde. 400 00:23:22,870 --> 00:23:25,777 That's the function that I'm going to integrate. 401 00:23:25,777 --> 00:23:27,610 And I can't remember what are the arguments, 402 00:23:27,610 --> 00:23:30,310 but it's going to be something like, from 0 to L, 403 00:23:30,310 --> 00:23:33,700 and then I have to give it a y0, and then maybe there's 404 00:23:33,700 --> 00:23:35,640 some other stuff up there. 405 00:23:35,640 --> 00:23:38,906 All right, do you guys remember the ode45? 406 00:23:38,906 --> 00:23:40,030 Is that in the right order? 407 00:23:40,030 --> 00:23:42,120 I don't remember. 408 00:23:42,120 --> 00:23:44,410 OK. 409 00:23:44,410 --> 00:23:48,640 So I need to specify the y0. 410 00:23:48,640 --> 00:23:56,910 So y0 is going to be equal to the initial value of z, 411 00:23:56,910 --> 00:23:58,462 the altitude. 412 00:23:58,462 --> 00:24:03,260 So it's going to be H. And then it's the initial value of vx. 413 00:24:03,260 --> 00:24:05,290 So I don't know what that is, but it's-- 414 00:24:05,290 --> 00:24:07,430 maybe you just want to call it v0. 415 00:24:07,430 --> 00:24:07,930 vx0. 416 00:24:11,570 --> 00:24:15,530 And then I do have one more condition here, 417 00:24:15,530 --> 00:24:18,480 that vz is related to vx. 418 00:24:18,480 --> 00:24:19,660 So I can use that. 419 00:24:19,660 --> 00:24:25,770 So I can have the last one be the square root of v0 squared 420 00:24:25,770 --> 00:24:27,902 minus vx0 squared. 421 00:24:32,160 --> 00:24:34,200 So that's the line for what y0 is. 422 00:24:36,940 --> 00:24:40,360 And then I solve this. 423 00:24:40,360 --> 00:24:44,260 And then I write the number of steps in the time 424 00:24:44,260 --> 00:24:46,260 stepping program that did, in order to get here. 425 00:24:46,260 --> 00:24:48,490 It was x stepping in this case. 426 00:24:48,490 --> 00:24:57,670 Num steps is equal to the length of x vec. 427 00:24:57,670 --> 00:25:07,010 And z of L is equal to z vec at N step. 428 00:25:07,010 --> 00:25:08,177 That's it, right? 429 00:25:12,470 --> 00:25:18,640 So that's the function that you would feed to f solve. 430 00:25:18,640 --> 00:25:20,830 And your correct value of vx 0 is 431 00:25:20,830 --> 00:25:24,250 the one that makes zL 0, which is what f solve tried to do. 432 00:25:24,250 --> 00:25:25,020 Yeah? 433 00:25:25,020 --> 00:25:35,580 AUDIENCE: [INAUDIBLE] 434 00:25:35,580 --> 00:25:40,170 PROFESSOR: You can, but in the physical problem, 435 00:25:40,170 --> 00:25:42,064 usually cannons always shoot upwards. 436 00:25:42,064 --> 00:25:43,230 So we'll just shoot upwards. 437 00:25:43,230 --> 00:25:46,110 But yeah, it could be either way. 438 00:25:46,110 --> 00:25:47,610 Yeah, and, in fact, in this problem, 439 00:25:47,610 --> 00:25:50,010 you might do better to change-- instead of using vx0 440 00:25:50,010 --> 00:25:55,110 as your unknown, you might want to change to theta, the angle, 441 00:25:55,110 --> 00:25:57,600 the elevation angle of the cannon, 442 00:25:57,600 --> 00:26:00,452 and that would be more physical of what the actual user 443 00:26:00,452 --> 00:26:01,410 of the cannon is using. 444 00:26:01,410 --> 00:26:03,201 They're adjusting theta, not adjusting vx0. 445 00:26:07,910 --> 00:26:09,606 It's no problem, actually. 446 00:26:09,606 --> 00:26:11,230 From the point of view of the f solves, 447 00:26:11,230 --> 00:26:13,440 you can make this theta instead. 448 00:26:13,440 --> 00:26:18,310 And then you'd have this be v0 times cos of theta, 449 00:26:18,310 --> 00:26:21,450 and this b v0 times sine of theta, 450 00:26:21,450 --> 00:26:24,180 and it would work just as well to get the solution. 451 00:26:24,180 --> 00:26:26,320 All right, so that's the shooting method. 452 00:26:26,320 --> 00:26:28,680 So this function g is the g that's 453 00:26:28,680 --> 00:26:33,390 going-- you'll have f solve, so is going to say, 454 00:26:33,390 --> 00:26:41,700 vx0 is equal to f solve of g. 455 00:26:41,700 --> 00:26:46,940 And then you have to have a guess, right? 456 00:26:46,940 --> 00:26:49,366 For f solve. 457 00:26:49,366 --> 00:26:51,240 So that's how you would invoke this function. 458 00:26:57,230 --> 00:27:00,670 All right, and so if we wanted to figure 459 00:27:00,670 --> 00:27:02,950 operation count of how many operations 460 00:27:02,950 --> 00:27:06,370 this is to find a solution this way, how's it go? 461 00:27:19,000 --> 00:27:21,300 How many iterations does it take to solve an ODE IVP. 462 00:27:24,419 --> 00:27:25,960 That depends on the step size, right? 463 00:27:25,960 --> 00:27:26,740 It's adaptive. 464 00:27:26,740 --> 00:27:29,660 Usually adaptive stepping. 465 00:27:29,660 --> 00:27:32,637 So you have some experience with that, maybe 100 steps? 466 00:27:32,637 --> 00:27:33,470 Something like that? 467 00:27:33,470 --> 00:27:34,220 Is usually enough? 468 00:27:34,220 --> 00:27:38,750 Maybe 1,000 if it's not stiff? 469 00:27:38,750 --> 00:27:41,240 And then how many iterations does it take 470 00:27:41,240 --> 00:27:42,558 f solve to solve something? 471 00:27:45,426 --> 00:27:47,250 10? 472 00:27:47,250 --> 00:27:51,960 So you have maybe 1,000 time steps, maybe 10 iterations, 473 00:27:51,960 --> 00:27:54,120 means 10 different initial values 474 00:27:54,120 --> 00:27:57,300 that you try before you convert to a solution. 475 00:27:57,300 --> 00:28:00,430 And then you may have to actually compute 476 00:28:00,430 --> 00:28:04,380 the Jacobian of g, inside f solve, 477 00:28:04,380 --> 00:28:07,230 if it's going to use the Newton-Raphson step, 478 00:28:07,230 --> 00:28:09,180 it's going to need the Jacobian of g. 479 00:28:09,180 --> 00:28:11,190 The Jacobian of g takes the number 480 00:28:11,190 --> 00:28:14,975 of unknowns times the number of function evaluations 481 00:28:14,975 --> 00:28:17,100 to compute it by finite differences-- maybe 2 times 482 00:28:17,100 --> 00:28:18,420 that number. 483 00:28:18,420 --> 00:28:23,390 So it's going to be something like n squared. 484 00:28:23,390 --> 00:28:26,560 It'll be n squared to evaluate the Jacobian. 485 00:28:26,560 --> 00:28:29,660 It takes n operations to evaluate f. 486 00:28:29,660 --> 00:28:32,200 So order of n, where n is the number of variables, 487 00:28:32,200 --> 00:28:35,720 n times that, to the Jacobian, so it would be like order 488 00:28:35,720 --> 00:28:41,570 of number variables squared times 10 times 1,000 is 489 00:28:41,570 --> 00:28:43,200 kind of an order of the cost. 490 00:28:47,610 --> 00:28:53,780 And it's only that cost because we can do an explicit solver. 491 00:28:53,780 --> 00:28:55,960 If you had to do an implicit ODE solution, 492 00:28:55,960 --> 00:28:57,460 it would be a lot more because you'd 493 00:28:57,460 --> 00:29:01,770 have to compute the Jacobians more often. 494 00:29:01,770 --> 00:29:02,270 All right. 495 00:29:02,270 --> 00:29:04,720 Is this fun? 496 00:29:04,720 --> 00:29:05,289 OK. 497 00:29:05,289 --> 00:29:06,580 So this is the shooting method. 498 00:29:06,580 --> 00:29:08,340 You guys should be able to do this no trouble. 499 00:29:08,340 --> 00:29:10,673 Conceptually, this is not so different than the homework 500 00:29:10,673 --> 00:29:13,830 problem you did where you did an optimization of the parameter 501 00:29:13,830 --> 00:29:14,775 values. 502 00:29:14,775 --> 00:29:15,566 Do you remember? 503 00:29:15,566 --> 00:29:17,190 So you had some differential equations, 504 00:29:17,190 --> 00:29:18,450 and you optimize the parameters to try 505 00:29:18,450 --> 00:29:19,575 to find the best solutions. 506 00:29:19,575 --> 00:29:22,045 Here, instead of optimizing them, you're doing f solve. 507 00:29:22,045 --> 00:29:24,253 You're trying to solve them to make something happen. 508 00:29:27,600 --> 00:29:29,920 Now how can this run into troubles. 509 00:29:29,920 --> 00:29:33,298 Why would this shooting method not always work? 510 00:29:36,440 --> 00:29:37,810 Ready why this might not work? 511 00:29:43,530 --> 00:29:44,544 Yeah? 512 00:29:44,544 --> 00:30:00,114 AUDIENCE: [INAUDIBLE] 513 00:30:00,114 --> 00:30:02,280 PROFESSOR: And a common case where that might happen 514 00:30:02,280 --> 00:30:06,520 would be if your ODE system was unstable, 515 00:30:06,520 --> 00:30:09,627 Or your ODE solution method was numerically unstable. 516 00:30:09,627 --> 00:30:11,960 In either of those cases, who knows what you're getting. 517 00:30:11,960 --> 00:30:14,376 And actually, you don't know if the solution is even real. 518 00:30:14,376 --> 00:30:16,350 You don't know if the computed final values 519 00:30:16,350 --> 00:30:22,180 zL is really what corresponds to that input value of vx0. 520 00:30:22,180 --> 00:30:25,145 Because, if you have a big kind of numerical sensitivity 521 00:30:25,145 --> 00:30:26,241 and instability. 522 00:30:26,241 --> 00:30:27,490 So that's one kind of problem. 523 00:30:27,490 --> 00:30:31,510 So this is just like all the ODE IVP problems. 524 00:30:31,510 --> 00:30:33,460 If the ODE's problem, intrinsically, 525 00:30:33,460 --> 00:30:36,340 is unstable in a big way, you're in trouble 526 00:30:36,340 --> 00:30:39,700 because your errors are going to amplify. 527 00:30:39,700 --> 00:30:44,030 And then also, if you have a problem where the delta 528 00:30:44,030 --> 00:30:47,920 t's are too large compared to this numerical stability 529 00:30:47,920 --> 00:30:50,090 of the solver, you'll also have a problem. 530 00:30:50,090 --> 00:30:52,210 So those are two kinds of problems that we always 531 00:30:52,210 --> 00:30:54,920 have in ODE solutions. 532 00:30:54,920 --> 00:30:56,560 And so, you might actually want to use 533 00:30:56,560 --> 00:31:02,127 this method for some regular ODE IVP problems. 534 00:31:02,127 --> 00:31:03,710 So for example, if you had a problem-- 535 00:31:10,239 --> 00:31:12,030 I don't want to wreck my beautiful artwork. 536 00:31:18,260 --> 00:31:19,290 You guys know this. 537 00:31:19,290 --> 00:31:19,790 All right. 538 00:31:26,270 --> 00:31:35,096 If you had a problem that said dy dt is equal to 10 539 00:31:35,096 --> 00:31:38,700 to the 6th times y. 540 00:31:38,700 --> 00:31:39,327 Yes? 541 00:31:39,327 --> 00:31:41,285 AUDIENCE: I have a question about the Jacobian. 542 00:31:41,285 --> 00:31:42,868 When you calculate the Jacobian do you 543 00:31:42,868 --> 00:31:45,000 have to solve the ODE system? 544 00:31:45,000 --> 00:31:46,680 PROFESSOR: Yes. 545 00:31:46,680 --> 00:31:47,630 Well, two ways. 546 00:31:47,630 --> 00:31:50,880 You can either solve it for repeated values, 547 00:31:50,880 --> 00:31:56,100 different initial values, of v0, and by finite difference, 548 00:31:56,100 --> 00:31:57,060 get the Jacobian. 549 00:31:57,060 --> 00:31:59,460 Or you could use the sensitivity method 550 00:31:59,460 --> 00:32:03,564 that we did in the second problem, a problem set ago, 551 00:32:03,564 --> 00:32:05,730 and analytically get the derivatives without respect 552 00:32:05,730 --> 00:32:07,402 to the parameters either way. 553 00:32:07,402 --> 00:32:08,860 But either way, it's a lot of work. 554 00:32:14,080 --> 00:32:19,520 So the from I guess this is a very simple problem, 555 00:32:19,520 --> 00:32:23,116 and suppose you wanted to go all the way out to t equals 1. 556 00:32:23,116 --> 00:32:30,605 Now, the problem is that the solution of this is Ae times 10 557 00:32:30,605 --> 00:32:33,920 to the 6th times t or something. 558 00:32:33,920 --> 00:32:36,530 So this is really not looking so great. 559 00:32:36,530 --> 00:32:39,110 As a problem to solve, this is about as unstable 560 00:32:39,110 --> 00:32:40,080 as you can get. 561 00:32:40,080 --> 00:32:43,472 The tiniest little deviation anywhere along the way 562 00:32:43,472 --> 00:32:44,930 is going to make the thing blow up. 563 00:32:47,600 --> 00:32:50,630 And so this is not so great and so even 564 00:32:50,630 --> 00:32:55,970 if initial condition is that y of t0 is equal to 10 565 00:32:55,970 --> 00:33:01,530 to the minus 12, so actually this is not so bad, 566 00:33:01,530 --> 00:33:04,250 this is still hard to solve, numerically. 567 00:33:04,250 --> 00:33:07,160 But you could flip it around, and treat it 568 00:33:07,160 --> 00:33:09,540 as a shooting problem, and solve it in reverse. 569 00:33:09,540 --> 00:33:14,130 So you could change variables that u is equal to negative t. 570 00:33:14,130 --> 00:33:20,100 And then you'd have dy du is equal to negative 10 571 00:33:20,100 --> 00:33:22,410 to the 6 times y. 572 00:33:22,410 --> 00:33:25,300 And now this is really stable. 573 00:33:25,300 --> 00:33:28,330 And now you might want to integrate in. 574 00:33:28,330 --> 00:33:30,580 So supposed the original question was, 575 00:33:30,580 --> 00:33:36,290 what is y of 1 in the differential equations? 576 00:33:36,290 --> 00:33:41,127 You could do it in reverse and say, I'm going to guess, y of 1 577 00:33:41,127 --> 00:33:41,960 is equal to y guess. 578 00:33:44,617 --> 00:33:46,700 And I'm going to integrate it and demand that this 579 00:33:46,700 --> 00:33:49,050 is my final condition. 580 00:33:49,050 --> 00:33:52,510 So now this is actually y-- 581 00:33:52,510 --> 00:33:55,840 oh geez, now I'm confusing myself. 582 00:33:55,840 --> 00:33:57,740 y of negative 1, I guess. 583 00:33:57,740 --> 00:34:00,500 So I just flipped the sign, t. 584 00:34:00,500 --> 00:34:06,190 And to make it easier, I would do it this way. 585 00:34:06,190 --> 00:34:08,989 1 minus t. 586 00:34:08,989 --> 00:34:10,164 Same derivative. 587 00:34:15,014 --> 00:34:17,929 So there we go. y0 is y guess. 588 00:34:17,929 --> 00:34:22,710 And y of 1 is 10 to the minus 12. 589 00:34:22,710 --> 00:34:26,320 So this is my final condition that I'm trying to shoot to, 590 00:34:26,320 --> 00:34:27,449 and I'll vary the y guess. 591 00:34:27,449 --> 00:34:28,199 And they're great. 592 00:34:28,199 --> 00:34:30,650 And now I have a perfectly stable differential equation 593 00:34:30,650 --> 00:34:32,060 I can solve. 594 00:34:32,060 --> 00:34:33,050 OK. 595 00:34:33,050 --> 00:34:35,022 So this same idea of shooting comes up 596 00:34:35,022 --> 00:34:36,320 in multiple applications. 597 00:34:36,320 --> 00:34:38,324 And this whole thing about flipping the change 598 00:34:38,324 --> 00:34:43,010 in the variables is often an extremely useful trick 599 00:34:43,010 --> 00:34:45,710 to just recast the equations in a way that's more numerically 600 00:34:45,710 --> 00:34:49,620 stable to solve, has fewer number of equations, 601 00:34:49,620 --> 00:34:52,440 you can write explicitly what you want. 602 00:34:52,440 --> 00:34:57,350 But this takes some cleverness to know how to recast them. 603 00:34:57,350 --> 00:35:03,080 All right, so this motivating example is a good one. 604 00:35:03,080 --> 00:35:04,170 Yeah? 605 00:35:04,170 --> 00:35:07,810 AUDIENCE: [INAUDIBLE] 606 00:35:07,810 --> 00:35:09,310 PROFESSOR: You could, but I was just 607 00:35:09,310 --> 00:35:12,400 trying to get back in the form of t0 equals zero. 608 00:35:12,400 --> 00:35:14,440 I guess I could have t0 equals negative 1 do it. 609 00:35:14,440 --> 00:35:17,236 I just couldn't do the arithmetic on the board. 610 00:35:17,236 --> 00:35:23,503 AUDIENCE: [INAUDIBLE] 611 00:35:23,503 --> 00:35:25,086 PROFESSOR: y of 0 is known, but then I 612 00:35:25,086 --> 00:35:26,800 have to start from t0 equals negative 1. 613 00:35:26,800 --> 00:35:27,880 So I could do-- 614 00:35:27,880 --> 00:35:31,065 so suppose I did u equals negative t dy 615 00:35:31,065 --> 00:35:37,860 du is equal to negative 10 to the 6 y. 616 00:35:37,860 --> 00:35:44,750 And I know y of 0 is equal to to-- 617 00:35:44,750 --> 00:35:46,550 no, what do I know? 618 00:35:46,550 --> 00:35:49,420 Yeah, y of 0 is equal to 10 to the minus 12. 619 00:35:49,420 --> 00:35:53,890 And y of negative 1 is equal to y yes, 620 00:35:53,890 --> 00:35:56,530 and I can integrate from negative 1 over. 621 00:35:56,530 --> 00:36:00,450 So this will t0 if I was using the shooting method, 622 00:36:00,450 --> 00:36:02,790 and this would be t final. 623 00:36:05,157 --> 00:36:06,990 Or you could shift it over by 1 if you want, 624 00:36:06,990 --> 00:36:08,180 and do it the way I did. 625 00:36:08,180 --> 00:36:11,772 Either one's fine. 626 00:36:11,772 --> 00:36:14,700 Is that all right? 627 00:36:14,700 --> 00:36:16,850 Sorry to confuse all the arithmetic. 628 00:36:16,850 --> 00:36:18,990 I was getting confused too. 629 00:36:18,990 --> 00:36:23,585 All right, now I wrote this-- 630 00:36:23,585 --> 00:36:26,540 another situation where this will not work 631 00:36:26,540 --> 00:36:30,840 is you can have systems where you 632 00:36:30,840 --> 00:36:35,230 have both positive and negative eigenvalues of the Jacobian, 633 00:36:35,230 --> 00:36:38,800 and that means that either way you integrate-- 634 00:36:38,800 --> 00:36:41,422 in the plus t direction or the negative t direction, 635 00:36:41,422 --> 00:36:42,755 either way it's always unstable. 636 00:36:45,720 --> 00:36:47,747 So no matter what you do, you're doomed. 637 00:36:47,747 --> 00:36:50,330 The IVP method is not going to work because you're numerically 638 00:36:50,330 --> 00:36:53,140 unstable in both directions. 639 00:36:53,140 --> 00:36:55,750 And so that's really a bummer, and it 640 00:36:55,750 --> 00:36:59,322 means our ODE IVP method's not going to work for us, 641 00:36:59,322 --> 00:37:01,280 and so then we have to find a different method. 642 00:37:04,230 --> 00:37:07,580 But before I go into that, let's just write 643 00:37:07,580 --> 00:37:11,170 the more general version of this. 644 00:37:11,170 --> 00:37:13,109 OK, so this is-- 645 00:37:13,109 --> 00:37:14,400 I think you guys all know this. 646 00:37:21,500 --> 00:37:24,290 So let's try a more general version of the ODE IVP problem. 647 00:37:27,935 --> 00:37:30,130 And now we'll allow for the fact that things 648 00:37:30,130 --> 00:37:31,796 don't have to be explicit, and they have 649 00:37:31,796 --> 00:37:33,520 to be as simple as we thought. 650 00:37:33,520 --> 00:37:35,395 And you can see it even in the problem I just 651 00:37:35,395 --> 00:37:39,940 did-- we had a vx squared plus vz squared had 652 00:37:39,940 --> 00:37:41,350 to be equal to something. 653 00:37:41,350 --> 00:37:43,570 And so that's not a simple boundary condition 654 00:37:43,570 --> 00:37:45,140 like we saw before. 655 00:37:45,140 --> 00:37:46,990 So you get a more complicated conditions, 656 00:37:46,990 --> 00:37:50,740 and what you really can have is a set of equations, 657 00:37:50,740 --> 00:38:03,310 gn of dy dt y, t, and is equal to 0. 658 00:38:03,310 --> 00:38:17,640 And corresponding, qn of dy dt evaluated at tn, y of tn, 659 00:38:17,640 --> 00:38:20,160 tn is equal to 0. 660 00:38:20,160 --> 00:38:23,300 So this is the general ODE system 661 00:38:23,300 --> 00:38:26,770 that's written in implicit form, and this 662 00:38:26,770 --> 00:38:32,790 has to be true for all t in the domain. 663 00:38:32,790 --> 00:38:36,060 All t that are a member of t0 to tf. 664 00:38:41,420 --> 00:38:45,300 So all the t's that are inside this interval, the domain we 665 00:38:45,300 --> 00:38:47,820 are about, this is the differential equation, written 666 00:38:47,820 --> 00:38:50,610 as just as general can be, and n is 667 00:38:50,610 --> 00:38:53,511 equal to 1 and N in these equations. 668 00:38:53,511 --> 00:38:57,405 AUDIENCE: Is there a reason you switched to q of n for the-- 669 00:38:57,405 --> 00:38:59,030 PROFESSOR: I just want to make it clear 670 00:38:59,030 --> 00:39:01,680 that this is the conditions, and this is the general equation. 671 00:39:01,680 --> 00:39:02,370 I don't know. 672 00:39:02,370 --> 00:39:03,745 You can write it anyway you want. 673 00:39:05,802 --> 00:39:07,760 Do you like some variable letters instead of q? 674 00:39:07,760 --> 00:39:08,780 I can change this. 675 00:39:08,780 --> 00:39:10,877 AUDIENCE: No, I was just checking. 676 00:39:10,877 --> 00:39:12,960 PROFESSOR: This one, I'm just trying to emphasize. 677 00:39:12,960 --> 00:39:16,940 This one is only true at tn only. 678 00:39:19,560 --> 00:39:22,050 This equation, this is the condition 679 00:39:22,050 --> 00:39:25,810 at one particular time I demand something be true, 680 00:39:25,810 --> 00:39:27,810 and this is the general difference equation that 681 00:39:27,810 --> 00:39:28,976 has to be true at all times. 682 00:39:31,942 --> 00:39:36,920 If I have n differentials, I need n differential equations, 683 00:39:36,920 --> 00:39:39,680 and n initial conditions. 684 00:39:39,680 --> 00:39:43,280 By the way, you can write the DAEs this way as well-- 685 00:39:43,280 --> 00:39:45,410 the differential algebraic equations, and then 686 00:39:45,410 --> 00:39:47,870 you just won't have as many initial conditions 687 00:39:47,870 --> 00:39:50,930 because every time you have an algebraic equation instead 688 00:39:50,930 --> 00:39:52,595 of a differential equation, then you 689 00:39:52,595 --> 00:39:55,220 don't need the initial condition because the algebraic equation 690 00:39:55,220 --> 00:39:58,900 has its own condition. 691 00:39:58,900 --> 00:40:00,540 Does that make sense? 692 00:40:00,540 --> 00:40:03,090 All right, so you can write this in general, and just 693 00:40:03,090 --> 00:40:04,500 by depending on how many differentials you have, 694 00:40:04,500 --> 00:40:06,000 that's how many conditions you need. 695 00:40:09,420 --> 00:40:11,490 A lot of times, you can write them explicit. 696 00:40:11,490 --> 00:40:18,814 This thing is equivalent to dy dt is equal to f of ty. 697 00:40:21,990 --> 00:40:24,460 Many times, you can solve for dy dt, and write this way, 698 00:40:24,460 --> 00:40:25,700 but not always. 699 00:40:25,700 --> 00:40:36,440 OK All right, and the reason why we need to have n conditions 700 00:40:36,440 --> 00:40:38,150 is just like when you're doing integrals, 701 00:40:38,150 --> 00:40:39,740 you'd have n constants of integration. 702 00:40:39,740 --> 00:40:42,020 Every time you do an integral, you get one, 703 00:40:42,020 --> 00:40:43,550 now you have three. 704 00:40:43,550 --> 00:40:45,050 We have n differential equations. 705 00:40:45,050 --> 00:40:46,415 We'll have n conditions. 706 00:40:51,540 --> 00:40:53,440 All right? 707 00:40:53,440 --> 00:40:59,130 Now, a bad thing about these problems, in general, 708 00:40:59,130 --> 00:41:03,360 is that the solutions depend a lot on the boundary conditions. 709 00:41:03,360 --> 00:41:08,670 And in fact, you can write down boundary conditions 710 00:41:08,670 --> 00:41:12,965 that are not achievable, which means there's no solution. 711 00:41:12,965 --> 00:41:14,340 So this is really a bummer if you 712 00:41:14,340 --> 00:41:16,830 don't realize you did it because you could try to solve it 713 00:41:16,830 --> 00:41:18,705 all day, and you'll never solve it because it 714 00:41:18,705 --> 00:41:20,460 doesn't have a solution. 715 00:41:20,460 --> 00:41:28,730 So for example, in this problem, if I set L to be too large, 716 00:41:28,730 --> 00:41:30,170 the cannonball can't go that far. 717 00:41:30,170 --> 00:41:33,640 I can't set L to be 3,000 kilometers 718 00:41:33,640 --> 00:41:35,890 and get a solution because the muzzle velocity is not 719 00:41:35,890 --> 00:41:37,556 high enough that the cannonball is going 720 00:41:37,556 --> 00:41:39,335 to travel 3,000 kilometers. 721 00:41:39,335 --> 00:41:41,710 But when I wrote the problem, you didn't see that, right? 722 00:41:41,710 --> 00:41:44,200 You didn't come and tell me, whoa, watch out. 723 00:41:44,200 --> 00:41:48,390 There's no way L could be bigger than such as such. 724 00:41:48,390 --> 00:41:50,200 And so you might not know it. 725 00:41:50,200 --> 00:41:55,600 You might specify a condition that's just not achievable. 726 00:41:55,600 --> 00:41:58,150 I used to work an industry, this happened a lot. 727 00:41:58,150 --> 00:42:00,160 My manager would specify boundary conditions 728 00:42:00,160 --> 00:42:03,280 which were not achievable. 729 00:42:03,280 --> 00:42:07,330 I want 99% yield and a 10% cost reduction. 730 00:42:07,330 --> 00:42:08,410 Go! 731 00:42:08,410 --> 00:42:11,170 And I'm the engineer, I'm trying to work it out, 732 00:42:11,170 --> 00:42:14,950 and then sometimes it didn't even come out. 733 00:42:14,950 --> 00:42:17,810 So in some ways, it's a lot better to just say max. 734 00:42:17,810 --> 00:42:20,010 Please maximize this as best you can, 735 00:42:20,010 --> 00:42:23,110 subject to your constraints, instead of specifying this. 736 00:42:23,110 --> 00:42:25,360 But of course, I don't know why, there's 737 00:42:25,360 --> 00:42:29,380 a school of management that says we weren't definite targets. 738 00:42:29,380 --> 00:42:33,610 We don't want to be just the best, we want to be perfect. 739 00:42:33,610 --> 00:42:34,900 So the no child left behind. 740 00:42:34,900 --> 00:42:36,880 Every single student in this class 741 00:42:36,880 --> 00:42:39,328 is going to really achieve. 742 00:42:39,328 --> 00:42:44,950 Anyway, that's the way targets gets set. 743 00:42:44,950 --> 00:42:47,180 It doesn't have to be achievable. 744 00:42:47,180 --> 00:42:49,120 And there's actually a big branch 745 00:42:49,120 --> 00:42:52,840 of mathematics about trying to detect if the boundary 746 00:42:52,840 --> 00:42:56,590 conditions are indeed consistent so that they can be achieved, 747 00:42:56,590 --> 00:42:58,600 and it's not so obvious to do it. 748 00:42:58,600 --> 00:43:02,440 So I'm not going to get into that at all. 749 00:43:02,440 --> 00:43:03,749 You can take a PDE class. 750 00:43:03,749 --> 00:43:05,290 There's a math department, and that's 751 00:43:05,290 --> 00:43:08,620 all they talk about all day is about how to figure out 752 00:43:08,620 --> 00:43:12,675 are these boundary conditions consistent or not consistent. 753 00:43:12,675 --> 00:43:14,050 You also have boundary conditions 754 00:43:14,050 --> 00:43:16,780 that are repetitive, and don't have enough information. 755 00:43:16,780 --> 00:43:18,970 In those cases, you might have an infinite number 756 00:43:18,970 --> 00:43:20,442 of solutions. 757 00:43:20,442 --> 00:43:22,150 And I think you can also have cases where 758 00:43:22,150 --> 00:43:25,280 you have multiple solutions. 759 00:43:25,280 --> 00:43:27,080 So like in the cannonball problem, 760 00:43:27,080 --> 00:43:29,822 if you could have a negative vy, and if the ship was 761 00:43:29,822 --> 00:43:32,030 close enough, you might be able to shoot it two ways. 762 00:43:32,030 --> 00:43:34,536 You can shoot it down at it, or you could just blow up high 763 00:43:34,536 --> 00:43:39,010 and come down, and they'll both be solutions that 764 00:43:39,010 --> 00:43:42,260 satisfy all the conditions. 765 00:43:42,260 --> 00:43:45,640 This is like general non-linear equation problems, 766 00:43:45,640 --> 00:43:47,837 that you don't know how many solutions you got, 767 00:43:47,837 --> 00:43:49,420 you don't know if you have a solution, 768 00:43:49,420 --> 00:43:50,650 you might have an infinite number of solutions, 769 00:43:50,650 --> 00:43:52,608 you might have some finite number of solutions, 770 00:43:52,608 --> 00:43:54,280 you don't know how many, and it's 771 00:43:54,280 --> 00:43:56,821 just that's the way life is, and you'll have to live with it. 772 00:43:56,821 --> 00:43:58,870 But it's kind of annoying sometimes. 773 00:43:58,870 --> 00:44:02,079 For now, let's just assume that we somehow know 774 00:44:02,079 --> 00:44:03,370 that we have a unique solution. 775 00:44:03,370 --> 00:44:04,480 There's a unique physical solution. 776 00:44:04,480 --> 00:44:05,740 We're just going to try to find that, 777 00:44:05,740 --> 00:44:07,090 and we're not going to worry about this other problem 778 00:44:07,090 --> 00:44:08,548 about the fact there could actually 779 00:44:08,548 --> 00:44:11,557 be multiple solutions, or no solution, or whatever. 780 00:44:11,557 --> 00:44:13,390 When you actually run into a case like that, 781 00:44:13,390 --> 00:44:15,910 then you'll really worry about it a lot. 782 00:44:15,910 --> 00:44:17,208 Is there a question? 783 00:44:17,208 --> 00:44:17,707 No? 784 00:44:17,707 --> 00:44:18,206 OK. 785 00:44:21,380 --> 00:44:26,620 All right, so we had an example in actually 786 00:44:26,620 --> 00:44:29,200 the zeroth homework, the very beginning, 787 00:44:29,200 --> 00:44:30,580 that had a problem like this. 788 00:44:34,080 --> 00:44:42,785 The homework 0P1, we had a problem where it gave you-- 789 00:44:42,785 --> 00:44:43,660 Do you remember this? 790 00:44:43,660 --> 00:44:48,310 It was a cylinder, and you were trying to compute t of r. 791 00:44:48,310 --> 00:44:49,590 Do you remember this? 792 00:44:49,590 --> 00:44:53,160 And it gave you some conditions about here. 793 00:44:56,830 --> 00:45:02,760 It gave you t when r w was equal to r, and it gave you dt dr-- 794 00:45:02,760 --> 00:45:06,380 actually, it gave you some equation. 795 00:45:06,380 --> 00:45:12,810 It was actually a function of this and t, all evaluated at r. 796 00:45:12,810 --> 00:45:14,710 It was equal to something. 797 00:45:14,710 --> 00:45:16,857 Do you remember this? 798 00:45:16,857 --> 00:45:18,440 So we gave those two, but then we also 799 00:45:18,440 --> 00:45:21,530 told you in the most recent homework, oh, by the way, 800 00:45:21,530 --> 00:45:27,140 dt dr has got to be equal to 0 at r equals 0. 801 00:45:27,140 --> 00:45:31,330 So this is one of these ones where we should only 802 00:45:31,330 --> 00:45:36,550 have two conditions, but we told you three conditions. 803 00:45:36,550 --> 00:45:41,180 So were any of you able to achieve all three conditions? 804 00:45:41,180 --> 00:45:41,680 No. 805 00:45:41,680 --> 00:45:44,500 OK, so this is highlighting the problem. 806 00:45:44,500 --> 00:45:46,420 So we gave you three boundary conditions 807 00:45:46,420 --> 00:45:48,102 that were apparently incompatible, 808 00:45:48,102 --> 00:45:50,560 that you couldn't actually solve them all at the same time. 809 00:45:53,220 --> 00:45:56,520 So beware, I guess. 810 00:45:56,520 --> 00:45:58,920 Now, in that problem, it might have 811 00:45:58,920 --> 00:46:02,130 been more natural to give you this equation, which 812 00:46:02,130 --> 00:46:06,580 we are sure is exactly true by the symmetry of the situation 813 00:46:06,580 --> 00:46:08,530 as one of the conditions, and then only 814 00:46:08,530 --> 00:46:10,680 one of these other conditions outside. 815 00:46:10,680 --> 00:46:13,330 That whichever one we were more sure was correct, 816 00:46:13,330 --> 00:46:16,370 might be the thing to do. 817 00:46:16,370 --> 00:46:19,390 And so we kind of gave you some goofball conditions. 818 00:46:19,390 --> 00:46:21,910 I guess, in some ways. 819 00:46:21,910 --> 00:46:22,410 Yeah? 820 00:46:22,410 --> 00:46:24,820 AUDIENCE: So if all three of those conditions are true, 821 00:46:24,820 --> 00:46:27,230 why wouldn't they converge to a solution? 822 00:46:27,230 --> 00:46:29,220 PROFESSOR: They could all be true, 823 00:46:29,220 --> 00:46:34,010 and if they were all true, then if you 824 00:46:34,010 --> 00:46:36,970 solve the numerical exactly, you should get the real solution. 825 00:46:36,970 --> 00:46:38,905 It should satisfy all of them. 826 00:46:38,905 --> 00:46:40,530 AUDIENCE: So does that mean one of them 827 00:46:40,530 --> 00:46:41,482 wasn't true in our case? 828 00:46:41,482 --> 00:46:42,440 If we weren't able to do-- 829 00:46:42,440 --> 00:46:44,000 PROFESSOR: Yeah, I think one of them wasn't true, 830 00:46:44,000 --> 00:46:45,666 and I think it's maybe due to round off. 831 00:46:49,030 --> 00:46:50,900 But it's highlights a problem. 832 00:46:50,900 --> 00:46:54,580 If you have three conditions that should be true, 833 00:46:54,580 --> 00:46:56,190 but they involve numbers in them, 834 00:46:56,190 --> 00:46:58,300 then often they won't all be exactly 835 00:46:58,300 --> 00:47:00,200 consistent with each other. 836 00:47:00,200 --> 00:47:02,090 But there's actually a worse kind of problem 837 00:47:02,090 --> 00:47:04,820 because it's close to being consistent to all 838 00:47:04,820 --> 00:47:10,400 of those conditions, but you're not exactly consistent. 839 00:47:10,400 --> 00:47:12,472 But then if you get into it, trying 840 00:47:12,472 --> 00:47:14,180 to figure what's going on, a lot of times 841 00:47:14,180 --> 00:47:15,971 you'll get near singular matrices and stuff 842 00:47:15,971 --> 00:47:18,320 because you have things that are nearly linearly 843 00:47:18,320 --> 00:47:20,310 dependent in some way. 844 00:47:20,310 --> 00:47:21,980 So really, it's better if you just 845 00:47:21,980 --> 00:47:24,440 have the right number of conditions that you're 846 00:47:24,440 --> 00:47:27,290 really sure really specify everything correctly, and just 847 00:47:27,290 --> 00:47:31,040 go with those, and treat the ones that you think 848 00:47:31,040 --> 00:47:33,560 would be nice if they were true as approximate things that 849 00:47:33,560 --> 00:47:36,018 are sort of physical checks to see whether your solution is 850 00:47:36,018 --> 00:47:37,830 reasonable. 851 00:47:37,830 --> 00:47:40,290 And we did it sort of like that in the problem you did. 852 00:47:40,290 --> 00:47:43,500 We said well, dt dr should really be equal to 0, 853 00:47:43,500 --> 00:47:46,350 but we didn't demand that in your solution. 854 00:47:46,350 --> 00:47:48,330 Your solution didn't actually satisfy that, 855 00:47:48,330 --> 00:47:51,150 and we use that as a measure of how far off your solution is. 856 00:47:51,150 --> 00:47:53,059 That's actually pretty useful in practice. 857 00:47:53,059 --> 00:47:53,850 You get a solution. 858 00:47:53,850 --> 00:47:56,040 It's good to have some additional condition 859 00:47:56,040 --> 00:47:59,490 that you can test for physical reasonableness of the solution, 860 00:47:59,490 --> 00:48:01,080 and particularly because there's a problem that you might have 861 00:48:01,080 --> 00:48:02,730 multiple solutions, and maybe one of them 862 00:48:02,730 --> 00:48:03,780 is a physical solution, and one of them 863 00:48:03,780 --> 00:48:05,490 is some other crazy solution. 864 00:48:05,490 --> 00:48:08,520 And so you need to have some way to detect 865 00:48:08,520 --> 00:48:11,725 the crazy solution by some other condition that you can test. 866 00:48:11,725 --> 00:48:12,600 Does that make sense? 867 00:48:18,460 --> 00:48:21,400 All right, so I said you could have cases where 868 00:48:21,400 --> 00:48:26,560 the Jacobian of your equation-- 869 00:48:30,000 --> 00:48:33,610 so you could be trying to solve this, and it could be, 870 00:48:33,610 --> 00:48:36,230 for some problems the Jacobian always 871 00:48:36,230 --> 00:48:40,320 has both positive and negative eigenvalues together. 872 00:48:40,320 --> 00:48:42,650 And in that case, using IVP is not 873 00:48:42,650 --> 00:48:45,530 going to be a smart idea because no matter which direction you 874 00:48:45,530 --> 00:48:49,490 integrate in, you're going to have a positive eigenvalue, 875 00:48:49,490 --> 00:48:51,987 and so then the IVP is not good. 876 00:48:51,987 --> 00:48:54,070 So instead, we're going to use a different method, 877 00:48:54,070 --> 00:48:55,540 and we'll talk about that next time, 878 00:48:55,540 --> 00:48:57,220 and those are called relaxation methods. 879 00:48:59,950 --> 00:49:01,960 And the concept of these is different 880 00:49:01,960 --> 00:49:03,250 than it was for shooting. 881 00:49:03,250 --> 00:49:16,330 So the relaxation method is you have a wide guess that you're 882 00:49:16,330 --> 00:49:19,324 going to have a guess for the entire y 883 00:49:19,324 --> 00:49:20,490 throughout the whole domain. 884 00:49:24,310 --> 00:49:26,230 Actually, a lot of times you might set this 885 00:49:26,230 --> 00:49:28,720 up so that y guess actually exactly 886 00:49:28,720 --> 00:49:30,994 satisfies the boundary conditions. 887 00:49:30,994 --> 00:49:32,910 So you know it satisfies those equations right 888 00:49:32,910 --> 00:49:35,243 from the beginning just from the way you set up y guess, 889 00:49:35,243 --> 00:49:37,950 but it won't satisfy the differential equation. 890 00:49:37,950 --> 00:49:44,280 And then what you'll do is you'll say 891 00:49:44,280 --> 00:50:01,110 how badly does it fail to satisfy that g is equal to 0? 892 00:50:01,110 --> 00:50:04,780 Because we really want g is equal 0 for the true solution. 893 00:50:04,780 --> 00:50:10,831 And we'll call this failure of our y guess to solve this, 894 00:50:10,831 --> 00:50:12,080 we'll call that the residuals. 895 00:50:12,080 --> 00:50:15,190 So we can actually plug in y guess in here, 896 00:50:15,190 --> 00:50:17,530 and y guess in here, and evaluate this. 897 00:50:17,530 --> 00:50:20,560 And normally it will not be 0 because our y 898 00:50:20,560 --> 00:50:23,476 guess is not perfect, and so it's going to deviate from 0. 899 00:50:23,476 --> 00:50:24,850 But how big it deviates from 0 is 900 00:50:24,850 --> 00:50:29,170 going to be our measure of how bad that guess was, 901 00:50:29,170 --> 00:50:31,200 and then we're going to try to change 902 00:50:31,200 --> 00:50:34,810 y guess to try to make it closer and closer to 0. 903 00:50:34,810 --> 00:50:36,220 So the idea is relax it. 904 00:50:36,220 --> 00:50:38,920 You get an incorrect solution, and you 905 00:50:38,920 --> 00:50:43,440 adjust it to relax it to make it become the correct solution. 906 00:50:43,440 --> 00:50:46,170 All right, and so that's the general idea of the relaxation 907 00:50:46,170 --> 00:50:49,290 method, and we'll talk about several different forms 908 00:50:49,290 --> 00:50:49,842 of that. 909 00:50:49,842 --> 00:50:51,300 Normally, what we have to do is you 910 00:50:51,300 --> 00:50:54,210 have to write y guess in terms of some parameters. 911 00:50:54,210 --> 00:50:59,347 So y guess of t depends on some parameters, 912 00:50:59,347 --> 00:51:00,930 and we're going adjust the parameters, 913 00:51:00,930 --> 00:51:03,550 and that's going to change what y guess is. 914 00:51:03,550 --> 00:51:06,910 And so for example, we could do a basis set expansion 915 00:51:06,910 --> 00:51:08,830 as we did in one of the earlier classes. 916 00:51:08,830 --> 00:51:10,540 We talked about how you could expand 917 00:51:10,540 --> 00:51:15,419 y guess as a sum of some basis functions weighted by p's, and 918 00:51:15,419 --> 00:51:16,960 then you can adjust the p's, and find 919 00:51:16,960 --> 00:51:20,470 the best possible set of p's to make this g as close to 0 920 00:51:20,470 --> 00:51:22,850 as possible, for example. 921 00:51:22,850 --> 00:51:25,200 We'll give examples of that next time. 922 00:51:25,200 --> 00:51:28,920 There's several choices about that there. 923 00:51:28,920 --> 00:51:30,560 All right.