1 00:00:00,000 --> 00:00:01,490 NARRATOR: The following content is 2 00:00:01,490 --> 00:00:04,690 provided by MIT OpenCourseWare under a Creative Commons 3 00:00:04,690 --> 00:00:06,410 license. 4 00:00:06,410 --> 00:00:08,200 Additional information about our license 5 00:00:08,200 --> 00:00:10,550 and MIT OpenCourseWare in general 6 00:00:10,550 --> 00:00:14,350 is available at ocw.mit.edu. 7 00:00:14,350 --> 00:00:21,850 PROFESSOR: So, ready for the second lecture about -- 8 00:00:21,850 --> 00:00:27,090 second to last lecture about the linear one-way wave equation, 9 00:00:27,090 --> 00:00:30,810 so the model for hyperbolic equations. 10 00:00:30,810 --> 00:00:37,350 That word, hyperbolic, tells me that signals are 11 00:00:37,350 --> 00:00:40,140 traveling with finite speed. 12 00:00:40,140 --> 00:00:44,530 In this case, the speed is c and in this case, 13 00:00:44,530 --> 00:00:47,290 the signals are only going to the left. 14 00:00:47,290 --> 00:00:50,600 The two-way wave equation will travel left and right, 15 00:00:50,600 --> 00:00:53,740 but again, finite speed. 16 00:00:53,740 --> 00:00:59,770 I emphasize finite speed, because for the heat equation, 17 00:00:59,770 --> 00:01:01,660 the speed is infinite. 18 00:01:01,660 --> 00:01:07,920 As soon as you change an initial condition, at any later time, 19 00:01:07,920 --> 00:01:13,250 you immediately feel the effect -- probably a small effect way, 20 00:01:13,250 --> 00:01:14,340 way out. 21 00:01:14,340 --> 00:01:18,000 So diffusion travels with infinite speed. 22 00:01:18,000 --> 00:01:23,110 Waves travel with finite speed. 23 00:01:23,110 --> 00:01:30,085 The difference sort of is that the true true growth factor G 24 00:01:30,085 --> 00:01:33,510 -- tiy remember, the true growth factor was, 25 00:01:33,510 --> 00:01:39,690 for the wave equation -- This is the G for the -- 26 00:01:39,690 --> 00:01:42,520 that multiplies the exponential e to the i*k*x 27 00:01:42,520 --> 00:01:48,670 in the difference equation -- and G, the true G, 28 00:01:48,670 --> 00:01:54,470 is e to the i*k*c*t. 29 00:01:57,140 --> 00:01:59,940 So that -- what I was going to say is, 30 00:01:59,940 --> 00:02:05,860 that has absolute value 1. 31 00:02:05,860 --> 00:02:09,130 Again, a difference from the heat equation. 32 00:02:09,130 --> 00:02:11,380 For the heat equation with diffusion, 33 00:02:11,380 --> 00:02:13,790 g will be smaller than 1. 34 00:02:13,790 --> 00:02:16,320 You're losing energy. 35 00:02:16,320 --> 00:02:20,090 For the wave equation, the energy is constant 36 00:02:20,090 --> 00:02:23,650 and the wave is just moving. 37 00:02:23,650 --> 00:02:26,650 So it's a little more delicate, because we're trying to -- 38 00:02:26,650 --> 00:02:31,150 this G in the difference equation has to stay -- 39 00:02:31,150 --> 00:02:34,580 be somehow close to that one, which is right on the unit 40 00:02:34,580 --> 00:02:38,460 circle and yet, we got to stay -- 41 00:02:38,460 --> 00:02:40,750 we can't go outside the unit circle. 42 00:02:40,750 --> 00:02:43,160 So here are two methods. 43 00:02:43,160 --> 00:02:46,860 We had one method last time that worked. 44 00:02:46,860 --> 00:02:50,550 That was one-sided differences and of course, you 45 00:02:50,550 --> 00:02:54,800 had to take the difference on the good side, the upwind side, 46 00:02:54,800 --> 00:02:57,320 and that was first order. 47 00:02:57,320 --> 00:03:00,160 The Courant-Friedrichs-Lewy condition 48 00:03:00,160 --> 00:03:03,490 was the same as the von Neumann stability condition 49 00:03:03,490 --> 00:03:07,390 and it was r between 0 and 1. 50 00:03:07,390 --> 00:03:15,180 r is this ratio, c delta t over delta x, it comes in. 51 00:03:15,180 --> 00:03:18,290 It comes into the wave equation. 52 00:03:18,290 --> 00:03:24,150 So now, we really have to think about better methods, 53 00:03:24,150 --> 00:03:25,800 other methods. 54 00:03:25,800 --> 00:03:29,970 And here are two: Lax-Friedrichs, 55 00:03:29,970 --> 00:03:32,380 which will only be first order. 56 00:03:32,380 --> 00:03:36,160 So when I -- these are the questions I always ask, 57 00:03:36,160 --> 00:03:38,290 and then finally, experiment. 58 00:03:43,990 --> 00:03:47,820 I mean, answering these questions will certainly 59 00:03:47,820 --> 00:03:50,460 be a guide to what we'll see experimentally, 60 00:03:50,460 --> 00:03:55,150 but there's more to learn from actually doing the numbers. 61 00:03:55,150 --> 00:04:00,810 The accuracy, Lax-Fridrichs, will be only first order, 62 00:04:00,810 --> 00:04:05,750 whereas Lax-Wendroff will be second order. 63 00:04:05,750 --> 00:04:11,240 So with respect to accuracy, that's certainly better. 64 00:04:11,240 --> 00:04:16,100 Can we see that maybe without too much calculation? 65 00:04:16,100 --> 00:04:21,620 The notes would have the more details. 66 00:04:21,620 --> 00:04:25,630 Can you see -- here's Lax-Wendroff, Lax-Friedrichs. 67 00:04:25,630 --> 00:04:28,030 So what's the idea of Lax-Friedrichs? 68 00:04:28,030 --> 00:04:32,020 You remember the total failure, the complete and absolute 69 00:04:32,020 --> 00:04:35,690 failure when we used a time difference there and a space 70 00:04:35,690 --> 00:04:38,820 difference there? 71 00:04:38,820 --> 00:04:44,510 You remember that that gave the time difference 72 00:04:44,510 --> 00:04:49,960 that produced a 1 in G and this space difference produced 73 00:04:49,960 --> 00:04:55,530 an imaginary part in G, so we had G as 1 plus something 74 00:04:55,530 --> 00:04:59,090 imaginary and we were outside the circle automatically. 75 00:04:59,090 --> 00:05:03,310 Friedrichs thought of a way to get around that. 76 00:05:03,310 --> 00:05:08,650 Instead of using U_(j, n) here, instead of the backward 77 00:05:08,650 --> 00:05:14,170 difference, he replaced U_(j, n) by the average of that value 78 00:05:14,170 --> 00:05:20,000 and that value, so that both sides now involved just two 79 00:05:20,000 --> 00:05:26,460 numbers -- U_(j, n) -- this one and this one. 80 00:05:26,460 --> 00:05:29,970 This one is not used now. 81 00:05:29,970 --> 00:05:35,250 Again, still first order, you won't be surprised 82 00:05:35,250 --> 00:05:42,410 that this approximation, this has got first-order error. 83 00:05:42,410 --> 00:05:47,410 But stability, now, is back with us and easy to check 84 00:05:47,410 --> 00:05:52,530 because now each new value depends on what old values -- 85 00:05:52,530 --> 00:05:56,220 just these two, and with what coefficients? 86 00:05:56,220 --> 00:06:00,910 So let me just check stability for Lax-Friedrichs. 87 00:06:00,910 --> 00:06:09,360 So U_(j+1, n), the new value, is some multiple of this guy, 88 00:06:09,360 --> 00:06:13,690 the one on the left, and some multiple of this one, 89 00:06:13,690 --> 00:06:16,270 the one on the right. 90 00:06:16,270 --> 00:06:17,980 What are those multiples? 91 00:06:17,980 --> 00:06:18,480 Let's see. 92 00:06:18,480 --> 00:06:20,820 I'm going to move things over to the right-hand side 93 00:06:20,820 --> 00:06:26,840 of the equation, so I think there's a half and then I think 94 00:06:26,840 --> 00:06:29,420 there's an r over -- minus, I guess. 95 00:06:29,420 --> 00:06:33,720 This is the one that comes in with a minus sign -- 96 00:06:33,720 --> 00:06:35,110 it's the one on the left. 97 00:06:35,110 --> 00:06:37,950 And the one on the right, U_(j+1, n), 98 00:06:37,950 --> 00:06:42,200 there's a half plus r over 2. 99 00:06:47,010 --> 00:06:49,300 Simple idea. 100 00:06:49,300 --> 00:06:56,030 Simple idea and it has one important advantage over 101 00:06:56,030 --> 00:06:59,060 upwind, one-sided that we saw last time. 102 00:06:59,060 --> 00:07:01,090 It's not a great method. 103 00:07:01,090 --> 00:07:03,520 It's only first order here. 104 00:07:03,520 --> 00:07:10,380 If I -- and you see when it's going to be stable? 105 00:07:10,380 --> 00:07:14,820 The coefficients add to 1. 106 00:07:14,820 --> 00:07:17,760 Our coefficients always add to 1, right? 107 00:07:17,760 --> 00:07:20,610 Because if we have a constant state, 108 00:07:20,610 --> 00:07:22,990 this next step should be that same state. 109 00:07:22,990 --> 00:07:32,200 It's not going to change, but instead of having the typical 1 110 00:07:32,200 --> 00:07:36,660 in the G, I have -- it's split into a half -- 111 00:07:36,660 --> 00:07:39,450 so what is G for this guy? 112 00:07:39,450 --> 00:07:44,740 G for this guy is this number: 1 minus r over 2 times e 113 00:07:44,740 --> 00:07:55,410 to the minus i*k delta x plus this number times e to the plus 114 00:07:55,410 --> 00:07:56,880 i*k delta x. 115 00:08:00,670 --> 00:08:03,980 You're seeing, now, the pattern. 116 00:08:03,980 --> 00:08:09,685 So I've sort of jumped to G without plugging in the e 117 00:08:09,685 --> 00:08:15,150 to the i*k*x, taking a step and then factoring out e 118 00:08:15,150 --> 00:08:16,190 to the i*k*x. 119 00:08:16,190 --> 00:08:19,990 I did it without writing down the e to the i*k*x. 120 00:08:19,990 --> 00:08:21,410 This is what factors out. 121 00:08:26,760 --> 00:08:29,420 Maybe a 1 plus r would be more correct. 122 00:08:32,230 --> 00:08:37,510 So stability requires this complex number, 123 00:08:37,510 --> 00:08:41,260 which I could write in different ways. 124 00:08:41,260 --> 00:08:44,040 The real part there would be a cosine. 125 00:08:44,040 --> 00:08:48,820 This would actually be the cosine plus r times the sine -- 126 00:08:48,820 --> 00:08:50,430 plus i*r times the sine. 127 00:08:50,430 --> 00:08:56,150 This is really -- I could rewrite that as cos k delta x 128 00:08:56,150 --> 00:09:01,630 plus i*r sine k delta x. 129 00:09:01,630 --> 00:09:03,150 I don't know which way you -- here, 130 00:09:03,150 --> 00:09:05,580 this shows you the real and imaginary parts. 131 00:09:05,580 --> 00:09:07,740 That makes it nice. 132 00:09:07,740 --> 00:09:10,390 This shows you the two coefficients. 133 00:09:10,390 --> 00:09:11,360 That makes it nice. 134 00:09:13,900 --> 00:09:17,160 Can you see stability -- so what is Courant-Friedrichs-Lewy? 135 00:09:19,770 --> 00:09:23,260 The characteristic discussion, the argument based 136 00:09:23,260 --> 00:09:27,260 on characteristics, says what? 137 00:09:27,260 --> 00:09:34,730 Stability is going mean that delta t -- 138 00:09:34,730 --> 00:09:38,860 stability is going to happen when r is below 1. 139 00:09:38,860 --> 00:09:44,670 It's just like upwind, except that r could also be coming -- 140 00:09:44,670 --> 00:09:48,560 c could have the opposite sign. 141 00:09:48,560 --> 00:09:50,660 Like Friedrichs is prepared for c 142 00:09:50,660 --> 00:09:55,960 to be positive or negative, because it's not purely 143 00:09:55,960 --> 00:09:58,170 upwind or purely downwind. 144 00:09:58,170 --> 00:10:00,170 It's both winds. 145 00:10:02,750 --> 00:10:08,720 You see that if r is anywhere -- the condition is going to be 146 00:10:08,720 --> 00:10:17,150 that minus 1 is -- r is between minus 1 and 1 -- 147 00:10:17,150 --> 00:10:21,020 see what's nice about Friedrichs in that case? 148 00:10:21,020 --> 00:10:24,580 This number is positive. 149 00:10:24,580 --> 00:10:29,930 This number is positive, because the 1 is bigger than the r. 150 00:10:32,620 --> 00:10:37,610 So each step -- and they add to 1. 151 00:10:37,610 --> 00:10:42,680 So each step takes the new value as a combination of the two 152 00:10:42,680 --> 00:10:47,330 old values and of course, the magnitude 153 00:10:47,330 --> 00:10:49,530 can't be bigger than 1. 154 00:10:49,530 --> 00:10:53,200 So under this condition, I have positive coefficients. 155 00:10:53,200 --> 00:10:56,530 That's positive and that's positive. 156 00:10:56,530 --> 00:11:03,630 They multiply things of absolute value 1, so they can't -- 157 00:11:03,630 --> 00:11:08,620 the sum can't get beyond 1 -- or you might like it here, 158 00:11:08,620 --> 00:11:12,700 that magnitude squared is cosined squared plus r squared 159 00:11:12,700 --> 00:11:16,300 sine squared, and if r is below 1, 160 00:11:16,300 --> 00:11:18,890 we're smaller than cosine squared plus sine squared, 161 00:11:18,890 --> 00:11:20,460 which is 1. 162 00:11:20,460 --> 00:11:24,450 So if I draw the -- just for a moment, 163 00:11:24,450 --> 00:11:30,870 if I draw the G in the complex plane -- 164 00:11:30,870 --> 00:11:35,320 so there's the unit circle. k equals 0 is always there. 165 00:11:35,320 --> 00:11:40,430 That's at 1, then these points -- 166 00:11:40,430 --> 00:11:45,270 I think probably those points fall on an ellipse here, 167 00:11:45,270 --> 00:11:54,400 where we go up as high as r, or magnitude of r, and we go left, 168 00:11:54,400 --> 00:12:01,060 right as far as -- this is k delta x equal pi -- 169 00:12:01,060 --> 00:12:02,890 as far as minus 1. 170 00:12:02,890 --> 00:12:11,320 So it's stable if this is less than 1. 171 00:12:11,320 --> 00:12:12,240 Nothing hard. 172 00:12:12,240 --> 00:12:16,080 In fact, easy. 173 00:12:16,080 --> 00:12:18,330 Two positive numbers that add to 1. 174 00:12:18,330 --> 00:12:26,270 Now, I've added a problem in the problem set. 175 00:12:26,270 --> 00:12:31,030 Not requiring it to be turned in, but just to mention it here 176 00:12:31,030 --> 00:12:38,410 -- that whenever the coefficients are all positive, 177 00:12:38,410 --> 00:12:41,500 the accuracy could only be first order, 178 00:12:41,500 --> 00:12:48,570 so we can't get too far with positive coefficients. 179 00:12:48,570 --> 00:12:53,060 First-order accuracy is the best possible, 180 00:12:53,060 --> 00:12:54,980 except in the extreme case when we're 181 00:12:54,980 --> 00:12:57,110 right on the characteristic. 182 00:12:57,110 --> 00:13:01,990 So if r was exactly 1 -- you remember that special case when 183 00:13:01,990 --> 00:13:06,360 r is exactly 1 and we're following exactly the line that 184 00:13:06,360 --> 00:13:09,520 carries the true information -- r is 1. 185 00:13:09,520 --> 00:13:15,730 That's gone and this is just -- so if r is 1, then U_(j+1, 186 00:13:15,730 --> 00:13:19,980 n) is U -- is this, is that number, 187 00:13:19,980 --> 00:13:23,570 and we're just carrying that information exactly. 188 00:13:23,570 --> 00:13:30,590 I have to say, again, that the idea of trying 189 00:13:30,590 --> 00:13:33,520 to follow that characteristic is a totally natural one 190 00:13:33,520 --> 00:13:40,250 and I'm not writing down, here, a method that tries to do that, 191 00:13:40,250 --> 00:13:44,450 but it wouldn't be a bad idea in one dimension. 192 00:13:44,450 --> 00:13:48,600 You couldn't do it, really, well in higher dimensions 193 00:13:48,600 --> 00:13:53,620 where these ideas do continue to apply. 194 00:13:53,620 --> 00:13:55,904 So that's Lex-Friedrichs. 195 00:13:55,904 --> 00:13:56,820 That's Lex-Friedrichs. 196 00:14:01,610 --> 00:14:03,880 So now, let me turn to Lax-Wendroff. 197 00:14:06,770 --> 00:14:12,740 These are natural ideas, but Lax and Wendroff did it first. 198 00:14:12,740 --> 00:14:20,710 They said, if I use these three values, all three, 199 00:14:20,710 --> 00:14:24,200 then certainly I can get the accuracy up 200 00:14:24,200 --> 00:14:27,800 one more because I have one more coefficient to choose. 201 00:14:27,800 --> 00:14:35,460 And to see what they did, the easiest way 202 00:14:35,460 --> 00:14:39,340 is to write it as a time difference 203 00:14:39,340 --> 00:14:43,030 on the left to see how they match. 204 00:14:43,030 --> 00:14:46,650 All they want to do with match that second term, that delta x 205 00:14:46,650 --> 00:14:49,420 squared term in the Taylor series. 206 00:14:53,320 --> 00:14:57,680 Because this is going to give us a d by dt, 207 00:14:57,680 --> 00:15:01,740 this will give us a d by dx centered, 208 00:15:01,740 --> 00:15:06,480 so we get extra accuracy there, and the matching that we need 209 00:15:06,480 --> 00:15:09,730 is this term. 210 00:15:09,730 --> 00:15:10,770 Do you recognize that? 211 00:15:10,770 --> 00:15:12,680 What does that term approximate? 212 00:15:16,280 --> 00:15:17,650 Hope I've got it right. 213 00:15:20,220 --> 00:15:25,940 That term approximates u_xx, right? 214 00:15:25,940 --> 00:15:31,820 So this is -- they've thrown in a term that approximates u_xx, 215 00:15:31,820 --> 00:15:38,660 and its purpose is to catch the next order of accuracy, 216 00:15:38,660 --> 00:15:41,790 and hopefully not lose stability, 217 00:15:41,790 --> 00:15:44,090 hopefully remain stable. 218 00:15:44,090 --> 00:15:52,050 So what Lax-Wendroff are doing is staying even closer 219 00:15:52,050 --> 00:15:52,890 to this curve. 220 00:15:55,460 --> 00:15:59,870 I guess I have forgotten exactly what their curve will be. 221 00:15:59,870 --> 00:16:04,010 If I write down G -- Oh, maybe you could ask MATLAB to do 222 00:16:04,010 --> 00:16:05,160 that. 223 00:16:05,160 --> 00:16:11,080 Write down the G for this, for Lax-Wendroff -- 224 00:16:11,080 --> 00:16:20,240 it's got that extra term -- and plot absolute value of G. 225 00:16:20,240 --> 00:16:26,740 I guess you might plot it along with the Lax-Friedrichs value. 226 00:16:26,740 --> 00:16:29,150 So what am I guessing? 227 00:16:29,150 --> 00:16:34,350 I'm pretty sure that the Lax-Wendroff 228 00:16:34,350 --> 00:16:37,550 one will hug the unit circle more closely, 229 00:16:37,550 --> 00:16:39,760 but it'll stay inside. 230 00:16:39,760 --> 00:16:49,890 So can I just -- Lax-Wendroff is G closer to 1, 231 00:16:49,890 --> 00:16:54,270 at least for small k, at least for small k. 232 00:16:54,270 --> 00:16:58,580 That's really where the accuracy is checked. 233 00:16:58,580 --> 00:17:01,010 How close does these Taylor series match? 234 00:17:05,970 --> 00:17:11,550 Lax-Wendroff match better and they stay inside. 235 00:17:11,550 --> 00:17:13,170 That takes a little calculation. 236 00:17:13,170 --> 00:17:20,120 Took me a while yesterday to rewrite the -- write out the G, 237 00:17:20,120 --> 00:17:23,750 square the real part, square the imaginary part, add them up, 238 00:17:23,750 --> 00:17:24,890 and this is what I got. 239 00:17:24,890 --> 00:17:29,270 So for Lax-Wendroff, I got G squared 240 00:17:29,270 --> 00:17:37,280 is 1 minus r squared minus r to the fourth times 1 241 00:17:37,280 --> 00:17:41,250 minus cosine k delta x squared. 242 00:17:43,810 --> 00:17:54,350 I put in the notes eventually, much algebra, 243 00:17:54,350 --> 00:17:58,280 but it does the job. 244 00:17:58,280 --> 00:18:02,250 Because if r squared -- so what's the stability condition? 245 00:18:02,250 --> 00:18:06,140 It's again this same guy, the same condition -- 246 00:18:06,140 --> 00:18:07,820 r squared below 1. 247 00:18:10,710 --> 00:18:14,490 Again, we could be -- we could have a left-going wave 248 00:18:14,490 --> 00:18:15,620 and a right-going wave. 249 00:18:15,620 --> 00:18:19,260 Now you'll say, what's the good of that? 250 00:18:19,260 --> 00:18:25,520 Here we just have one wave, but on Friday, we'll 251 00:18:25,520 --> 00:18:27,760 have a wave going both ways. 252 00:18:27,760 --> 00:18:31,660 So Lax-Friedrichs and Lax-Wendroff 253 00:18:31,660 --> 00:18:33,390 can both deal with that. 254 00:18:33,390 --> 00:18:35,890 In fact, their stability conditions are the same 255 00:18:35,890 --> 00:18:37,520 and in fact, you may be wondering, 256 00:18:37,520 --> 00:18:40,220 why would anybody use Lax-Friedrichs when 257 00:18:40,220 --> 00:18:43,830 Lax-Wendroff gives higher accuracy 258 00:18:43,830 --> 00:18:48,110 at no real significant increase in cost? 259 00:18:48,110 --> 00:18:50,480 So Lax-Wendroff is a favorite. 260 00:18:53,250 --> 00:18:57,020 Don't forget, still, experiment has 261 00:18:57,020 --> 00:19:04,590 to be done to see what it really does in practice, because right 262 00:19:04,590 --> 00:19:08,350 now, everything's looking in Lax-Wendroff's favor 263 00:19:08,350 --> 00:19:11,950 with one exception. 264 00:19:11,950 --> 00:19:17,200 Lax-Friedrichs, which only used these two coefficients, 265 00:19:17,200 --> 00:19:18,870 had them positive. 266 00:19:18,870 --> 00:19:20,320 This is positive. 267 00:19:20,320 --> 00:19:25,410 This is positive, where Lax-Wendroff 268 00:19:25,410 --> 00:19:27,411 is going to have a negative. 269 00:19:27,411 --> 00:19:27,910 Let's see. 270 00:19:27,910 --> 00:19:32,490 Where will our negative -- I think there'll be a negative 271 00:19:32,490 --> 00:19:35,420 coefficient in here somewhere. 272 00:19:35,420 --> 00:19:40,110 Probably one of the three outside guys. 273 00:19:40,110 --> 00:19:43,250 I know that we couldn't have three positive coefficients 274 00:19:43,250 --> 00:19:44,790 and get up to second-order accuracy. 275 00:19:48,690 --> 00:19:53,150 Now, where do we pay the price for that? 276 00:19:53,150 --> 00:19:57,790 Where do we pay the price -- I should finish here. 277 00:19:57,790 --> 00:19:59,980 Suppose r squared's bigger than 1. 278 00:19:59,980 --> 00:20:08,630 If you accept this calculation, which has a nice result, 279 00:20:08,630 --> 00:20:13,080 but took a while -- if r squared's below 1, 280 00:20:13,080 --> 00:20:14,990 then what do I know about G? 281 00:20:17,840 --> 00:20:21,730 Suppose r squared's bigger than 1. 282 00:20:21,730 --> 00:20:25,120 What can we say from this formula? 283 00:20:25,120 --> 00:20:26,800 Does that hit you right away? 284 00:20:29,620 --> 00:20:38,740 G -- if r squared -- this is certainly -- absolute G. 285 00:20:38,740 --> 00:20:43,470 I've taken the actual G and squared its real part, 286 00:20:43,470 --> 00:20:48,240 squared its imaginary part, did all the algebra I could think 287 00:20:48,240 --> 00:20:50,870 of, and got this answer. 288 00:20:54,740 --> 00:20:57,920 For the magnitude squared -- so the magnitude squared is never 289 00:20:57,920 --> 00:20:59,030 going to go below 0. 290 00:20:59,030 --> 00:21:00,640 I don't have to think of that. 291 00:21:00,640 --> 00:21:04,690 It's just I want to be sure it's below 1. 292 00:21:04,690 --> 00:21:06,790 So all I really want to do is be sure 293 00:21:06,790 --> 00:21:11,960 that I'm subtracting something positive. 294 00:21:11,960 --> 00:21:14,490 Am I subtracting something positive? 295 00:21:14,490 --> 00:21:17,190 That's certainly positive. 296 00:21:17,190 --> 00:21:18,310 Is this positive? 297 00:21:21,410 --> 00:21:24,970 r squared'll be bigger than r to the fourth. 298 00:21:24,970 --> 00:21:28,290 If r squared's less than 1, then r to the fourth 299 00:21:28,290 --> 00:21:30,040 is even smaller. 300 00:21:30,040 --> 00:21:32,000 So this is positive, this is positive. 301 00:21:32,000 --> 00:21:39,460 I'm subtracting something, so G is certainly not bigger than 1. 302 00:21:39,460 --> 00:21:45,460 So that formula really makes it evident 303 00:21:45,460 --> 00:21:47,310 and I guess also evident that we're 304 00:21:47,310 --> 00:21:49,390 getting some high accuracy. 305 00:21:49,390 --> 00:21:58,620 You see, what's the size of this when k is small? 306 00:21:58,620 --> 00:22:05,950 When k is small, if I'm taking the cosine of a small angle -- 307 00:22:05,950 --> 00:22:08,860 what am I looking at there? 308 00:22:08,860 --> 00:22:13,200 If this is a small angle theta, I'm looking at 1 minus cosine 309 00:22:13,200 --> 00:22:16,050 theta -- that's of what order? 310 00:22:16,050 --> 00:22:17,550 Theta squared. 311 00:22:17,550 --> 00:22:18,410 Theta squared. 312 00:22:21,530 --> 00:22:26,307 Then that's squared again, so that I'm up to theta 313 00:22:26,307 --> 00:22:26,890 to the fourth. 314 00:22:26,890 --> 00:22:30,360 That's why I'm getting off to a good start. 315 00:22:34,810 --> 00:22:41,780 So stability we've got, two-sided we've got, 316 00:22:41,780 --> 00:22:48,900 experiment -- can I just try to draw a little graph of what I 317 00:22:48,900 --> 00:22:58,610 think the two methods will do for our model problem? 318 00:22:58,610 --> 00:23:04,580 Like this model problem of a wave moving along? 319 00:23:07,610 --> 00:23:15,190 I want to try to draw it at, let's say, t equal to 1, 320 00:23:15,190 --> 00:23:17,860 for example. 321 00:23:17,860 --> 00:23:21,980 So at t equal 1, the wave should be here. 322 00:23:25,950 --> 00:23:30,630 I'll draw -- you might say this is totally unsatisfactory, 323 00:23:30,630 --> 00:23:37,961 and it is, because I'm just drawing by hand what you can 324 00:23:37,961 --> 00:23:38,460 see. 325 00:23:38,460 --> 00:23:39,540 Maybe you should. 326 00:23:39,540 --> 00:23:42,220 This would be a perfect experiment and I really could 327 00:23:42,220 --> 00:23:49,370 use, for the notes -- the notes could use a proper graph. 328 00:23:49,370 --> 00:23:53,870 I think what you see -- let's see. 329 00:23:53,870 --> 00:23:59,440 At t equal 1, both methods are going to be 0 way out here 330 00:23:59,440 --> 00:24:03,690 and they'll be 1 way out here. 331 00:24:03,690 --> 00:24:04,610 Why's that? 332 00:24:04,610 --> 00:24:07,980 Because the signal speed is finite, right? 333 00:24:07,980 --> 00:24:13,230 This way out here, it hasn't heard about this wave of water. 334 00:24:13,230 --> 00:24:17,770 Way out here, it doesn't know that it's not a constant. 335 00:24:17,770 --> 00:24:24,040 The question is, and I guess the thing has moved, so maybe -- 336 00:24:24,040 --> 00:24:26,880 can I try roughly? 337 00:24:26,880 --> 00:24:33,010 So the true wall of water would be that. 338 00:24:33,010 --> 00:24:37,490 I think that what Lax-Wendroff -- Lax-Friedrichs -- 339 00:24:37,490 --> 00:24:42,300 so Lax-Friedrichs, with positive coefficients, 340 00:24:42,300 --> 00:24:51,470 will show a smooth profile, but the perfect signal will get 341 00:24:51,470 --> 00:24:52,990 spread out. 342 00:24:52,990 --> 00:24:54,890 The perfect signal will get spread out. 343 00:24:54,890 --> 00:24:57,000 Why is that? 344 00:24:57,000 --> 00:24:58,860 Let me just draw a spread out signal. 345 00:24:58,860 --> 00:25:00,780 So apologies to do this by hand. 346 00:25:00,780 --> 00:25:03,830 I think it's probably going to be pretty centered, 347 00:25:03,830 --> 00:25:07,290 but it's going to be spread out. 348 00:25:07,290 --> 00:25:09,840 So that, I think, would be Lax-Friedrichs. 349 00:25:14,990 --> 00:25:16,330 That's very rough, right? 350 00:25:16,330 --> 00:25:25,130 But I really -- hearty thanks for anybody who gives me a code 351 00:25:25,130 --> 00:25:34,600 that does it and graphs it. 352 00:25:34,600 --> 00:25:39,370 But the main point is, we have a lot of smearing here. 353 00:25:39,370 --> 00:25:44,040 The accuracy is not going to be terrific. 354 00:25:44,040 --> 00:25:48,740 But there isn't any bumpiness. 355 00:25:48,740 --> 00:25:53,320 The reason there's no bumpiness is that we're Lax-Freidrichs 356 00:25:53,320 --> 00:26:03,030 with -- has these positive coefficients, 357 00:26:03,030 --> 00:26:06,600 so that every value always has to stay between 0 and 1. 358 00:26:06,600 --> 00:26:09,140 The starting values were between 0 and 1. 359 00:26:09,140 --> 00:26:13,890 At every step, the values are between 0 and 1, 360 00:26:13,890 --> 00:26:16,830 because we're always taking a combination 361 00:26:16,830 --> 00:26:21,240 of a positive multiple of one value 362 00:26:21,240 --> 00:26:24,000 and another positive multiple of the other value 363 00:26:24,000 --> 00:26:26,800 and the two coefficients adding to one. 364 00:26:26,800 --> 00:26:32,840 We're taking 30% of one and 70% of another and we never -- 365 00:26:32,840 --> 00:26:36,290 we're always in between the 0 and the 1. 366 00:26:36,290 --> 00:26:41,000 What about Lax-Wendroff? 367 00:26:41,000 --> 00:26:44,810 What are you expecting for Lax-Wendroff? 368 00:26:44,810 --> 00:26:48,540 Expecting better accuracy, expecting -- 369 00:26:48,540 --> 00:26:52,090 if I were on the ball, I'd have another color. 370 00:26:52,090 --> 00:26:59,870 Lax-Wendroff will be a much better profile, sharper 371 00:26:59,870 --> 00:27:07,390 profile, but you know what the price is going to be? 372 00:27:07,390 --> 00:27:09,900 There'll be some oscillation. 373 00:27:09,900 --> 00:27:13,770 There'll be some oscillations behind -- I think behind -- 374 00:27:13,770 --> 00:27:16,300 oh gosh, I should know. 375 00:27:16,300 --> 00:27:22,150 Forgive me for -- I can fix these if you'll tell me how, 376 00:27:22,150 --> 00:27:26,400 on the next -- because I'm not sure that -- 377 00:27:26,400 --> 00:27:28,499 I should know whether they're at both -- 378 00:27:28,499 --> 00:27:30,540 or whether the oscillations happens at both ends. 379 00:27:30,540 --> 00:27:31,920 I doubt it. 380 00:27:31,920 --> 00:27:32,790 No, I doubt it. 381 00:27:32,790 --> 00:27:34,300 I don't think it will. 382 00:27:34,300 --> 00:27:35,560 Why do I not think it well? 383 00:27:35,560 --> 00:27:40,900 Because in Lax-Wendroff, the three coefficients -- 384 00:27:40,900 --> 00:27:44,670 one of them will be negative and two will be positive. 385 00:27:44,670 --> 00:27:47,680 They'll add to 1, of course. 386 00:27:47,680 --> 00:27:50,840 So the oscillations, which are coming 387 00:27:50,840 --> 00:27:55,090 from sometimes a negative coefficient, sometimes 388 00:27:55,090 --> 00:27:59,340 a positive, will all be on one side. 389 00:27:59,340 --> 00:28:05,700 So only one of those oscillations [UNINTELLIGIBLE] 390 00:28:05,700 --> 00:28:12,270 So this is my picture of -- can I -- of Lax-Wendroff, 391 00:28:12,270 --> 00:28:31,080 with oscillations behind the wave front. 392 00:28:31,080 --> 00:28:33,790 All right. 393 00:28:33,790 --> 00:28:36,310 If you've done any computing, you, 394 00:28:36,310 --> 00:28:38,890 when you see these oscillations, you immediately 395 00:28:38,890 --> 00:28:43,650 think of somebody's name, which is Gibbs. 396 00:28:43,650 --> 00:28:46,400 Of course, Gibbs -- do you remember the Gibbs phenomenon 397 00:28:46,400 --> 00:28:50,650 that comes when you're approximating a square wave, 398 00:28:50,650 --> 00:28:57,240 like there, by pure Fourier series? 399 00:28:57,240 --> 00:29:01,490 So the Gibbs, the classical Gibbs phenomenon is, 400 00:29:01,490 --> 00:29:03,980 take the Fourier series for a square wave -- well, 401 00:29:03,980 --> 00:29:09,680 it's smooth -- and then truncate that series, 402 00:29:09,680 --> 00:29:14,690 cut that series off at 100 terms or 1,000 terms. 403 00:29:14,690 --> 00:29:20,240 Gibbs noticed -- and it's always a problem -- 404 00:29:20,240 --> 00:29:30,350 that these oscillations appear right near the front. 405 00:29:30,350 --> 00:29:36,360 So, far away, no problem, but here we 406 00:29:36,360 --> 00:29:38,650 really see it only on one side, because we're not 407 00:29:38,650 --> 00:29:42,130 doing Gibbs' Fourier series experiment. 408 00:29:42,130 --> 00:29:46,790 We're doing Lax-Wendroff wave equation. 409 00:29:46,790 --> 00:29:49,220 When I say we, I really hope you'll do it 410 00:29:49,220 --> 00:29:55,240 and a few lines of MATLAB will be greatly appreciated. 411 00:29:55,240 --> 00:30:02,940 Maybe Mr. Cho can -- you could email to him, for example, 412 00:30:02,940 --> 00:30:06,680 a code and the plot. 413 00:30:06,680 --> 00:30:09,950 So what does that tell us? 414 00:30:09,950 --> 00:30:15,350 Tells us Lax-Wendroff has got a lot of potential, 415 00:30:15,350 --> 00:30:20,140 but this oscillation isn't good. 416 00:30:24,072 --> 00:30:25,530 How are you going to get rid of it? 417 00:30:29,090 --> 00:30:32,010 How do you get rid of bumpiness? 418 00:30:32,010 --> 00:30:36,450 You introduce diffusion. 419 00:30:36,450 --> 00:30:43,610 So diffusion, heat equation stuff smooth things out. 420 00:30:43,610 --> 00:30:46,170 Wave equations don't smooth things out. 421 00:30:46,170 --> 00:30:51,280 This wall of water in the wave equation stayed a sharp wall. 422 00:30:51,280 --> 00:30:55,880 But we'll see very soon in the heat equation, diffusion, 423 00:30:55,880 --> 00:30:59,810 viscosity, all those physical things 424 00:30:59,810 --> 00:31:04,570 connect, numerically, to a smoother solution, 425 00:31:04,570 --> 00:31:06,920 smoother profile. 426 00:31:06,920 --> 00:31:13,280 So that is really a key idea, is -- and we'll see it, 427 00:31:13,280 --> 00:31:16,880 but it will make the problem not linear. 428 00:31:16,880 --> 00:31:19,760 If we want to stay with a linear equation 429 00:31:19,760 --> 00:31:23,890 and increase the accuracy, we're going to get oscillation. 430 00:31:23,890 --> 00:31:28,670 But if we locate the oscillation, 431 00:31:28,670 --> 00:31:33,200 introduce some diffusion in the right place, 432 00:31:33,200 --> 00:31:37,070 we can reduce the oscillation. 433 00:31:37,070 --> 00:31:43,480 So that's where -- this is what you really have to do if you 434 00:31:43,480 --> 00:31:50,370 want good output from numerical methods. 435 00:31:50,370 --> 00:31:52,920 Even on this simple model problem, 436 00:31:52,920 --> 00:31:59,950 you'll have to have this idea of numerical viscosity. 437 00:31:59,950 --> 00:32:03,340 Artificial viscosity, numerical diffusion 438 00:32:03,340 --> 00:32:04,710 popped in at the right spot. 439 00:32:07,390 --> 00:32:08,670 So we'll see that. 440 00:32:08,670 --> 00:32:12,460 Maybe the right place to see it will be for when the equation 441 00:32:12,460 --> 00:32:15,330 itself is already nonlinear. 442 00:32:15,330 --> 00:32:18,720 That's where it has developed a lot. 443 00:32:18,720 --> 00:32:21,810 So we'll -- when we get to nonlinear wave equations, 444 00:32:21,810 --> 00:32:26,910 which isn't far off, that's what we'll see. 445 00:32:26,910 --> 00:32:36,830 So now, I guess I have one more topic in this lecture. 446 00:32:36,830 --> 00:32:40,620 That is convergence. 447 00:32:40,620 --> 00:32:45,280 How do you show that -- we know, we sort of know that we need 448 00:32:45,280 --> 00:32:45,860 stability. 449 00:32:48,790 --> 00:32:50,780 So I guess I'm going to have to come 450 00:32:50,780 --> 00:32:52,870 to the question of convergence. 451 00:32:52,870 --> 00:32:53,570 All right. 452 00:32:53,570 --> 00:32:59,310 And of course, I have to mention -- more than mention -- 453 00:32:59,310 --> 00:33:08,970 the key result in the whole theory, the connection -- 454 00:33:08,970 --> 00:33:12,790 so we have methods that are first order or second order -- 455 00:33:12,790 --> 00:33:18,810 stable or unstable, and then the key idea is this Lax -- again, 456 00:33:18,810 --> 00:33:21,340 he enters -- Lax equivalency. 457 00:33:28,660 --> 00:33:32,410 So this is a little bit of pure math, comes into this, 458 00:33:32,410 --> 00:33:36,690 and it gives exactly the result we would expect. 459 00:33:36,690 --> 00:33:48,450 Stability implies convergence and convergence 460 00:33:48,450 --> 00:33:50,770 implies stability. 461 00:33:50,770 --> 00:33:54,690 So that's the two ideas are equivalent, 462 00:33:54,690 --> 00:33:57,770 provided we're talking about a decent problem, 463 00:33:57,770 --> 00:34:12,980 for a consistent approximation to well-posed problems. 464 00:34:19,640 --> 00:34:23,780 I've got four words on the board, four keywords here. 465 00:34:23,780 --> 00:34:26,180 Stability, we kind of know what that means. 466 00:34:26,180 --> 00:34:28,360 Convergence. 467 00:34:28,360 --> 00:34:33,330 These are the new words and I'll just -- and actually -- 468 00:34:33,330 --> 00:34:38,190 so consistent means that the method is at least first order 469 00:34:38,190 --> 00:34:43,210 and that the difference equation approaches the differential 470 00:34:43,210 --> 00:34:48,150 equation at a single step. 471 00:34:48,150 --> 00:34:51,690 Well-posed means that the differential equation is OK. 472 00:34:54,240 --> 00:34:58,730 So, for example, what would be a non-well-posed problem? 473 00:35:02,500 --> 00:35:04,630 When we get to the heat equation, 474 00:35:04,630 --> 00:35:09,210 if you ran the heat equation backward in time, 475 00:35:09,210 --> 00:35:15,262 that would give us an equation du/dt as minus u_xx. 476 00:35:15,262 --> 00:35:16,470 That would be not well-posed. 477 00:35:19,090 --> 00:35:20,570 That would be not well-posed. 478 00:35:20,570 --> 00:35:26,250 Or, if you tried to solve Laplace's equation equation -- 479 00:35:26,250 --> 00:35:35,862 say, u_tt plus u_xx equals 0 -- from initial values, 480 00:35:35,862 --> 00:35:37,070 that would not be well-posed. 481 00:35:40,180 --> 00:35:42,700 But we're dealing with well-posed problems. 482 00:35:42,700 --> 00:35:48,540 The wave equation, which has the right sign< and the heat 483 00:35:48,540 --> 00:35:50,120 equation with the right sign. 484 00:35:50,120 --> 00:35:52,010 So our problems are going to be well-posed. 485 00:35:52,010 --> 00:35:55,210 You can safely think we're only talking 486 00:35:55,210 --> 00:35:59,160 about consistent approximations to well-posed problems. 487 00:35:59,160 --> 00:36:01,250 Here is the main point. 488 00:36:01,250 --> 00:36:05,250 Stability holds if and only if the convergence holds. 489 00:36:05,250 --> 00:36:08,960 So there's actually two things to show there. 490 00:36:08,960 --> 00:36:12,780 How does stability give convergence? 491 00:36:12,780 --> 00:36:16,990 Why does convergence require stability? 492 00:36:16,990 --> 00:36:21,730 So that instability could not [UNINTELLIGIBLE] 493 00:36:21,730 --> 00:36:26,430 So that's sort of maybe the fundamental theorem 494 00:36:26,430 --> 00:36:28,540 of numerical analysis. 495 00:36:31,700 --> 00:36:37,990 The fact that stability, a -- we better say what stability is, 496 00:36:37,990 --> 00:36:39,470 and what is convergence. 497 00:36:39,470 --> 00:36:49,310 So let me capture these in inequalities, 498 00:36:49,310 --> 00:36:54,190 in mathematical terms rather than just words. 499 00:36:57,550 --> 00:37:00,380 So those are the ideas -- maybe I'm going to have to write 500 00:37:00,380 --> 00:37:07,820 a little above here, but -- so what does -- what's our method? 501 00:37:07,820 --> 00:37:10,340 So I need some notation and then I'll lift the board 502 00:37:10,340 --> 00:37:12,890 and we'll see what each thing means. 503 00:37:12,890 --> 00:37:19,250 So our method, we're allowing any difference method 504 00:37:19,250 --> 00:37:21,630 that moves forward in time. 505 00:37:21,630 --> 00:37:24,490 There's time. 506 00:37:24,490 --> 00:37:31,540 Let me use R for the true operator that 507 00:37:31,540 --> 00:37:35,870 takes the function, follows the differential equation 508 00:37:35,870 --> 00:37:36,600 to the next time. 509 00:37:36,600 --> 00:37:43,810 So I'm going to say that true u, which is always a small u, 510 00:37:43,810 --> 00:37:50,020 at delta t is some R, something R times u of t, 511 00:37:50,020 --> 00:37:59,680 where the approximate guy is some s times U of t. 512 00:37:59,680 --> 00:38:03,230 So R is the true solution. 513 00:38:03,230 --> 00:38:04,230 So well-posed. 514 00:38:04,230 --> 00:38:09,420 So of course to take -- if this is n delta t, 515 00:38:09,420 --> 00:38:16,582 then we've taken R n times, so the true solution is R 516 00:38:16,582 --> 00:38:19,540 to the n-th times the initial value, 517 00:38:19,540 --> 00:38:26,570 and the approximate guy is S^n times the initial value 518 00:38:26,570 --> 00:38:32,420 and we'll -- we might as well start out with those the same. 519 00:38:32,420 --> 00:38:35,300 So that's what R and S are. 520 00:38:35,300 --> 00:38:40,150 Now, we got three ideas here. 521 00:38:40,150 --> 00:38:41,470 What does well-posed mean? 522 00:38:47,180 --> 00:38:54,230 Well-posed means that the true thing is bounded. 523 00:38:54,230 --> 00:38:59,730 That R to the n-th times u is less than some constant times 524 00:38:59,730 --> 00:39:00,230 u. 525 00:39:08,520 --> 00:39:10,620 These inequalities are sort of part 526 00:39:10,620 --> 00:39:16,330 of the mathematics of partial differential equations. 527 00:39:16,330 --> 00:39:25,210 I think you've got to take them as not -- I mean, 528 00:39:25,210 --> 00:39:27,720 take them as sort of a reasonable statement that 529 00:39:27,720 --> 00:39:31,980 the -- this is energy, this u typically will measure 530 00:39:31,980 --> 00:39:33,310 the energy. 531 00:39:33,310 --> 00:39:39,280 And in our wave equation, C_1, the constant C_1 will be? 532 00:39:39,280 --> 00:39:40,160 1. 533 00:39:40,160 --> 00:39:43,800 The energy doesn't change. 534 00:39:43,800 --> 00:39:48,730 In another problem, we could allow the possibility of C_1 535 00:39:48,730 --> 00:39:53,670 being a little bigger than 1, but think of C_1 as 1. 536 00:39:56,280 --> 00:40:07,160 Then, stability will be a bound on S to the n, say, C_2. 537 00:40:13,600 --> 00:40:17,730 And again, in our example, C_2 has been 1. 538 00:40:17,730 --> 00:40:22,390 This is like -- C_2 is like -- I mean, 539 00:40:22,390 --> 00:40:26,310 S to the n-th on each exponential is this G 540 00:40:26,310 --> 00:40:29,560 to the n-th, and G is below 1. 541 00:40:29,560 --> 00:40:32,920 So often, C_1 and C_2 will be 1. 542 00:40:36,130 --> 00:40:41,810 Then finally, what is this ideas of consistency? 543 00:40:41,810 --> 00:40:47,130 And this means -- consistent means that -- 544 00:40:47,130 --> 00:40:49,320 so what's consistency? 545 00:40:49,320 --> 00:40:56,000 Consistent is comparing the differential equation 546 00:40:56,000 --> 00:40:58,190 with the difference equation. 547 00:40:58,190 --> 00:41:05,160 It's comparing R with S and at a single step, 548 00:41:05,160 --> 00:41:06,820 they should be close. 549 00:41:06,820 --> 00:41:15,410 So at a single step, R minus S u, that's the -- 550 00:41:15,410 --> 00:41:19,070 starting with the same u, I'm just taking one step 551 00:41:19,070 --> 00:41:22,180 in the differential equation and comparing it with one step 552 00:41:22,180 --> 00:41:27,040 in the difference equation -- and I would want that to be 553 00:41:27,040 --> 00:41:32,810 C_3, maybe delta t to the p plus 1. 554 00:41:32,810 --> 00:41:43,100 Was that -- is that -- times size of u, I think. 555 00:41:43,100 --> 00:41:47,060 Order delta t to the p plus 1. 556 00:41:47,060 --> 00:41:48,480 Like delta t squared. 557 00:41:53,240 --> 00:41:59,250 This would be the usual situation, that -- 558 00:41:59,250 --> 00:42:02,710 when it's stable. 559 00:42:02,710 --> 00:42:06,840 So at the moment then, I want to say, if these are all true, 560 00:42:06,840 --> 00:42:09,490 then I get convergence because -- 561 00:42:09,490 --> 00:42:13,270 what I'm now going to do is show that stability implies 562 00:42:13,270 --> 00:42:16,280 convergence. 563 00:42:16,280 --> 00:42:21,740 It's what we did for ordinary differential equations. 564 00:42:21,740 --> 00:42:23,720 This was the local error. 565 00:42:23,720 --> 00:42:27,090 This is the local error that I called DE, the discreditization 566 00:42:27,090 --> 00:42:29,710 error. 567 00:42:29,710 --> 00:42:34,040 These are saying -- so this is saying that the -- 568 00:42:34,040 --> 00:42:36,290 here's really what happens. 569 00:42:36,290 --> 00:42:41,320 So I want to look at the error up here after n steps. 570 00:42:41,320 --> 00:42:45,710 So the error after n steps -- typical term is, 571 00:42:45,710 --> 00:42:48,430 I follow the differential equation. 572 00:42:48,430 --> 00:42:50,250 That's u. 573 00:42:50,250 --> 00:42:54,470 Then I have this little error DE, 574 00:42:54,470 --> 00:42:59,410 which I make at that step, the difference between R and S, 575 00:42:59,410 --> 00:43:05,110 and then I follow the difference equation 576 00:43:05,110 --> 00:43:08,190 up to the remaining time. 577 00:43:08,190 --> 00:43:14,660 What I want to show is that I can track the error 578 00:43:14,660 --> 00:43:19,650 and bound it. 579 00:43:19,650 --> 00:43:22,010 I don't know if you remember the discussion 580 00:43:22,010 --> 00:43:23,910 for ordinary differential equations, 581 00:43:23,910 --> 00:43:25,680 but it went the same way. 582 00:43:25,680 --> 00:43:31,220 We had -- we looked at the new error DE that was produced 583 00:43:31,220 --> 00:43:32,950 at each time step k. 584 00:43:35,510 --> 00:43:39,880 When we took k steps of -- when we got up to this point with 585 00:43:39,880 --> 00:43:42,810 the true solution, we plugged the true solution 586 00:43:42,810 --> 00:43:47,810 into the difference equation, it had a little error and whatever 587 00:43:47,810 --> 00:43:51,940 error there was, that got thrown in with other errors 588 00:43:51,940 --> 00:43:56,840 and propagated up to any later time n. 589 00:44:00,240 --> 00:44:04,270 Am I bringing back what we did there, or just -- 590 00:44:04,270 --> 00:44:07,180 you can just see that's what we're going to have here. 591 00:44:07,180 --> 00:44:08,630 Now, how will I express that? 592 00:44:11,380 --> 00:44:14,840 Somehow, I have to estimate the difference between R 593 00:44:14,840 --> 00:44:17,930 to the n-th and S to the n-th. 594 00:44:17,930 --> 00:44:19,890 That's really my problem. 595 00:44:19,890 --> 00:44:21,230 Actually, it's a nice problem. 596 00:44:23,860 --> 00:44:28,770 Suppose I have control of powers of R and S, 597 00:44:28,770 --> 00:44:34,220 and I know that R minus S is small somehow. 598 00:44:34,220 --> 00:44:37,580 How do I show that R to the n-th minus S to the n-th is small? 599 00:44:37,580 --> 00:44:39,990 That's my job. 600 00:44:39,990 --> 00:44:45,780 This is the error when I apply it to a starting value u. 601 00:44:45,780 --> 00:44:49,070 This is the difference between little u and big U. 602 00:44:49,070 --> 00:44:54,730 So how do I -- what I want to do is split it out into this 603 00:44:54,730 --> 00:44:58,320 situation where I just have one R minus S. 604 00:44:58,320 --> 00:45:00,800 I think this'll work. 605 00:45:00,800 --> 00:45:05,870 So suppose I have -- I think I could start with R to the n 606 00:45:05,870 --> 00:45:13,150 minus 1 times R minus S, and then an R to the n minus 2 607 00:45:13,150 --> 00:45:20,230 times an R minus S times an S. Maybe I don't -- sorry, 608 00:45:20,230 --> 00:45:23,730 this guy is going to carry and I'd rather do -- sorry. 609 00:45:26,330 --> 00:45:31,300 Got to do it right, because I want the R's to come first. 610 00:45:31,300 --> 00:45:44,470 I want maybe R minus S times S to the n minus 1 and then -- 611 00:45:44,470 --> 00:45:45,470 sorry. 612 00:45:45,470 --> 00:45:48,580 I want R's on the right. 613 00:45:51,360 --> 00:45:52,580 Good. 614 00:45:52,580 --> 00:45:55,170 Finally got it. 615 00:45:55,170 --> 00:45:58,570 So that gives me the R of the n-th, but I've subtracted off, 616 00:45:58,570 --> 00:46:13,920 so I need an S R minus S R to the n minus 2 and so on. 617 00:46:13,920 --> 00:46:20,090 Sorry for this bit of algebra in the middle of practical things, 618 00:46:20,090 --> 00:46:25,790 but do you see that this is the case where I followed 619 00:46:25,790 --> 00:46:28,680 the differential equation up and at the last step 620 00:46:28,680 --> 00:46:30,760 I made an error? 621 00:46:30,760 --> 00:46:33,110 This is the case where I followed the differential 622 00:46:33,110 --> 00:46:35,750 equation almost to the top, I made an error 623 00:46:35,750 --> 00:46:41,380 and then I had one more step to go with the difference. 624 00:46:41,380 --> 00:46:44,840 The S is doing this part, so a typical term 625 00:46:44,840 --> 00:46:50,420 will be a power of S, S to some power, R minus S, 626 00:46:50,420 --> 00:46:53,270 R to some power. 627 00:46:53,270 --> 00:46:56,930 I'm breaking the error at n steps 628 00:46:56,930 --> 00:47:01,810 into n different terms, each from the error at one step. 629 00:47:01,810 --> 00:47:03,870 This is the error at the last step, 630 00:47:03,870 --> 00:47:07,270 this is the error at the next-to-last step, and so on. 631 00:47:07,270 --> 00:47:09,970 We've got it. 632 00:47:09,970 --> 00:47:13,430 Because I just estimate every term, 633 00:47:13,430 --> 00:47:18,060 every term has a power of R, which gives me a C_1; 634 00:47:18,060 --> 00:47:20,630 a power of S, which gives me a C_2; 635 00:47:20,630 --> 00:47:24,600 and the discreditization error, the one-step actual error, 636 00:47:24,600 --> 00:47:28,410 R minus S, which gives me a C_3; and this delta t 637 00:47:28,410 --> 00:47:30,380 to the p plus 1. 638 00:47:30,380 --> 00:47:37,960 You see that I'm just piling up n of these, 639 00:47:37,960 --> 00:47:41,470 so I'm getting n of those, delta t to the p plus 1, 640 00:47:41,470 --> 00:47:46,770 so the final result will be, I'll have n of these delta t 641 00:47:46,770 --> 00:47:53,260 to the p plus 1's and that will be T -- n delta t -- 642 00:47:53,260 --> 00:47:55,230 delta t to the p. 643 00:47:55,230 --> 00:47:56,280 So that'll be the error. 644 00:48:00,520 --> 00:48:02,770 Since I went to all the trouble of defining 645 00:48:02,770 --> 00:48:06,540 a C_1, C_2, and C_3, those three numbers. 646 00:48:06,540 --> 00:48:10,990 So the error -- there'll be a C_1 times C_2 times C_3 647 00:48:10,990 --> 00:48:16,830 constant there, in the bound. 648 00:48:16,830 --> 00:48:20,310 Have a look at the notes for that 649 00:48:20,310 --> 00:48:27,380 and let me just conclude with Lax's insight 650 00:48:27,380 --> 00:48:30,380 on the other part. 651 00:48:30,380 --> 00:48:34,970 The fact that convergence requires stability. 652 00:48:38,840 --> 00:48:42,250 So you see, what I've shown is that if we're stable, 653 00:48:42,250 --> 00:48:45,330 if I bound these, bound these, bound these, 654 00:48:45,330 --> 00:48:48,310 then I have a bound on the error. 655 00:48:48,310 --> 00:48:49,500 That's convergence. 656 00:48:49,500 --> 00:48:53,830 The other way is, if it's unstable, 657 00:48:53,830 --> 00:48:56,220 how do you know it couldn't converge? 658 00:48:56,220 --> 00:49:00,970 How do we know that convergence requires stability? 659 00:49:00,970 --> 00:49:03,240 It's a little delicate, so I just -- 660 00:49:03,240 --> 00:49:05,810 this is the last 30 seconds of the lecture, 661 00:49:05,810 --> 00:49:13,310 just to mention this point, because it's easy to miss a key 662 00:49:13,310 --> 00:49:15,510 point here. 663 00:49:15,510 --> 00:49:19,605 We've tracked a different -- now I'm supposing that the method 664 00:49:19,605 --> 00:49:23,920 is unstable and I want to show that it will fail, right? 665 00:49:23,920 --> 00:49:26,280 That's my job now. 666 00:49:26,280 --> 00:49:28,740 That's Lax's -- other half of Lax's theorem: 667 00:49:28,740 --> 00:49:31,010 If it's unstable, the method will fail. 668 00:49:31,010 --> 00:49:36,040 There'll be some initial value for which it blows up. 669 00:49:36,040 --> 00:49:39,130 Now you might say, that initial value is just e to the i*k*x. 670 00:49:41,660 --> 00:49:44,460 But, we didn't follow this point, 671 00:49:44,460 --> 00:49:50,830 but if I take an e to the i*k*x where G is bigger than 1 -- 672 00:49:50,830 --> 00:49:53,950 of course, that is getting amplified a bit, 673 00:49:53,950 --> 00:49:56,640 but for that particular e to the i*k*x, 674 00:49:56,640 --> 00:50:01,520 when delta t decreases -- so if I have a -- you see, 675 00:50:01,520 --> 00:50:03,210 this is a k delta x. 676 00:50:03,210 --> 00:50:06,890 What I'm trying to say is that for a fixed k, 677 00:50:06,890 --> 00:50:10,110 even an unstable method can work. 678 00:50:10,110 --> 00:50:14,640 For a fixed frequency k, as delta t and delta x gets 679 00:50:14,640 --> 00:50:19,720 smaller -- these guys, whether they're outside or inside, 680 00:50:19,720 --> 00:50:23,600 will be coming down toward 1 and if you're patient, 681 00:50:23,600 --> 00:50:25,780 you could see it actually worked. 682 00:50:25,780 --> 00:50:32,760 So it's -- somehow, the initial function that doesn't work, 683 00:50:32,760 --> 00:50:36,800 that blows up, is a combination of frequencies. 684 00:50:36,800 --> 00:50:41,810 A single frequency, actually, you move down here and it's not 685 00:50:41,810 --> 00:50:45,700 catastrophic in the end, but a combination of frequencies, 686 00:50:45,700 --> 00:50:47,740 so that as one frequency moves down, 687 00:50:47,740 --> 00:50:50,000 another one is moving into this position, 688 00:50:50,000 --> 00:50:55,680 another one into this -- there is a typical initial function 689 00:50:55,680 --> 00:50:58,140 and it is disaster. 690 00:50:58,140 --> 00:51:02,750 So that's what Lax had to catch. 691 00:51:02,750 --> 00:51:08,500 The notes will use the single word, uniform boundedness. 692 00:51:08,500 --> 00:51:13,220 Anyway, this is one point where pure math -- 693 00:51:13,220 --> 00:51:19,920 a kind of neat result in pure math says that if stability 694 00:51:19,920 --> 00:51:27,790 fails, then there is some single starting value on which it will 695 00:51:27,790 --> 00:51:29,730 fail. 696 00:51:29,730 --> 00:51:32,520 That starting value won't be a pure e to the i*k*x, 697 00:51:32,520 --> 00:51:39,410 because it, as we said, actually in the end gets to be OK, 698 00:51:39,410 --> 00:51:42,640 but there will be a combination of frequencies that'll fail 699 00:51:42,640 --> 00:51:45,850 and so convergence will fail. 700 00:51:45,850 --> 00:51:49,010 So that's the key theorem. 701 00:51:49,010 --> 00:51:52,300 I probably won't use the word theorem again, 702 00:51:52,300 --> 00:51:55,470 but this is one time when it's justified 703 00:51:55,470 --> 00:52:04,340 and when a little sort of abstract functional analysis 704 00:52:04,340 --> 00:52:09,890 gives the conclusion that convergence requires stability. 705 00:52:09,890 --> 00:52:12,670 So you'll see that in the notes and next time, 706 00:52:12,670 --> 00:52:18,440 we move on to the true wave equation, second order. 707 00:52:18,440 --> 00:52:19,690 Thanks.