1 00:00:01,260 --> 00:00:02,093 Welcome back. 2 00:00:02,093 --> 00:00:04,290 We're gonna switch gear a little bit now 3 00:00:04,290 --> 00:00:07,260 and move away from sort of mathematical treatment 4 00:00:07,260 --> 00:00:08,820 of this continuous model 5 00:00:08,820 --> 00:00:11,520 and think about how to implement them computationally. 6 00:00:13,950 --> 00:00:15,600 So as I said in the previous video, 7 00:00:15,600 --> 00:00:18,930 one of the big strengths of differential equations 8 00:00:18,930 --> 00:00:23,580 is that they give you, without any additional alteration, 9 00:00:23,580 --> 00:00:25,980 a complete view of the flow diagram 10 00:00:25,980 --> 00:00:27,000 because that's literally 11 00:00:27,000 --> 00:00:29,160 what those differential equations are 12 00:00:29,160 --> 00:00:31,920 is the flow or the speed of the system 13 00:00:31,920 --> 00:00:34,980 at any point in variable space. 14 00:00:34,980 --> 00:00:38,160 So if you tell me the state, x of a system, 15 00:00:38,160 --> 00:00:42,060 the time derivative of x of t gives me the direction 16 00:00:42,060 --> 00:00:46,560 of the movement of the system, as well as its speed, 17 00:00:46,560 --> 00:00:48,513 how fast is it going there? 18 00:00:49,770 --> 00:00:51,600 I have three different notations right now. 19 00:00:51,600 --> 00:00:53,580 So you're probably most used 20 00:00:53,580 --> 00:00:56,550 to the explicit time derivative. 21 00:00:56,550 --> 00:00:59,070 As I said, I like using Newton's notation. 22 00:00:59,070 --> 00:01:01,645 It's just a little simpler, 23 00:01:01,645 --> 00:01:05,670 this dot representing a time derivative, 24 00:01:05,670 --> 00:01:09,690 and really the way we write those differential equation 25 00:01:09,690 --> 00:01:12,510 is having x dot or s dot or i dot, whatever it is, 26 00:01:12,510 --> 00:01:15,454 equal to some function of the state of the system x, 27 00:01:15,454 --> 00:01:18,573 maybe also explicitly of time, t. 28 00:01:20,160 --> 00:01:23,119 So these differential equations are always written 29 00:01:23,119 --> 00:01:26,130 as x dot equals f of x of t. 30 00:01:26,130 --> 00:01:27,120 That's our differential, 31 00:01:27,120 --> 00:01:29,163 our system of differential equations. 32 00:01:30,300 --> 00:01:34,230 So in this video, what I'd like to describe is 33 00:01:34,230 --> 00:01:36,030 what you'll be doing often, 34 00:01:36,030 --> 00:01:38,100 which is not necessarily mathematical analysis 35 00:01:38,100 --> 00:01:39,450 over these differential equations, 36 00:01:39,450 --> 00:01:41,160 but just tracking them in time. 37 00:01:41,160 --> 00:01:43,200 So you put the system in some initial state, 38 00:01:43,200 --> 00:01:46,590 you have some initial conditions, x at t equals zero, 39 00:01:46,590 --> 00:01:49,473 and you wanna follow this flow of dynamics. 40 00:01:53,970 --> 00:01:56,340 So let's say that our system here 41 00:01:56,340 --> 00:01:57,930 has only one degree of freedom. 42 00:01:57,930 --> 00:02:00,540 This x of t is just one variable, 43 00:02:00,540 --> 00:02:04,800 and we're interested in knowing from x0. 44 00:02:04,800 --> 00:02:07,260 An initial condition of T equals zero, 45 00:02:07,260 --> 00:02:10,173 the state of the system for all t, for all time. 46 00:02:13,440 --> 00:02:18,440 Now there might be some true evolution for this system, 47 00:02:19,350 --> 00:02:20,883 which might look like this, 48 00:02:23,400 --> 00:02:26,433 but that would be the true x of t. 49 00:02:29,550 --> 00:02:33,150 The simplest way to follow it numerically 50 00:02:33,150 --> 00:02:35,309 is discretized time, the same way we're doing 51 00:02:35,309 --> 00:02:37,590 in discretized model. 52 00:02:37,590 --> 00:02:39,300 So at t equal zero, 53 00:02:39,300 --> 00:02:43,650 you can evaluate your differential equation, x dot of t. 54 00:02:43,650 --> 00:02:47,643 So you evaluate this function, f of x of t here, 55 00:02:48,750 --> 00:02:52,680 and what it gives you is the instantaneous derivative 56 00:02:52,680 --> 00:02:53,523 at that point. 57 00:02:55,200 --> 00:02:58,420 So then one thing you can do once you have that is say 58 00:02:59,580 --> 00:03:04,580 x at time, t, plus h where h is some time step, 59 00:03:09,480 --> 00:03:13,110 simply gonna be equal to where I am 60 00:03:13,110 --> 00:03:16,800 plus the projection over h of the slope, 61 00:03:16,800 --> 00:03:20,640 f of x of t, my differential equation. 62 00:03:20,640 --> 00:03:22,410 And then that might put me here. 63 00:03:22,410 --> 00:03:25,140 And then I reevaluate my equation, 64 00:03:25,140 --> 00:03:30,003 project myself, reevaluate project, project, project. 65 00:03:31,590 --> 00:03:32,580 And as you can see, 66 00:03:32,580 --> 00:03:37,580 I don't expect to get exactly the right distribution. 67 00:03:39,600 --> 00:03:43,380 I mean, I'm doing a little bit of whatever here, 68 00:03:43,380 --> 00:03:46,294 but the point is I expect to get something 69 00:03:46,294 --> 00:03:50,433 that's close to the true solution, but that deviates. 70 00:03:52,350 --> 00:03:54,900 So this method, the simplest method 71 00:03:54,900 --> 00:03:56,763 is called Euler's method. 72 00:04:05,550 --> 00:04:09,570 And we're gonna say that its local error 73 00:04:13,260 --> 00:04:18,260 is of order, it's a big O here, order h squared. 74 00:04:21,210 --> 00:04:25,923 The reason for that is we know that there's a true x of t, 75 00:04:27,870 --> 00:04:30,693 and then there's the x of t from Euler's method. 76 00:04:32,760 --> 00:04:37,000 And we can write x of t plus h 77 00:04:38,820 --> 00:04:41,160 by developing around x of t, 78 00:04:41,160 --> 00:04:46,160 the Taylor series of the true solution. 79 00:04:48,150 --> 00:04:53,150 So we know that it's gonna be x of t plus h 80 00:04:53,700 --> 00:04:57,570 f of x of t plus... 81 00:04:57,570 --> 00:04:59,160 While we're doing that step, 82 00:04:59,160 --> 00:05:02,730 we know that the system continues evolving, 83 00:05:02,730 --> 00:05:04,140 continues following the dynamics. 84 00:05:04,140 --> 00:05:05,760 So there is some curvature, 85 00:05:05,760 --> 00:05:10,760 curvature f prime of x of t plus h cubed. 86 00:05:11,190 --> 00:05:13,470 If you remember your Taylor series, 87 00:05:13,470 --> 00:05:17,793 three factorials, f prime prime of x of t, and so on. 88 00:05:19,110 --> 00:05:21,660 And so the reason why we say that Euler's method 89 00:05:21,660 --> 00:05:25,120 as a local error term in h squared 90 00:05:26,130 --> 00:05:30,720 is because it captures those first term 91 00:05:30,720 --> 00:05:32,343 of the Taylor series, 92 00:05:33,360 --> 00:05:37,893 but ignores the higher order term, 93 00:05:38,970 --> 00:05:41,163 so ignored by Euler. 94 00:05:43,200 --> 00:05:46,800 And so at every time step h that we do, 95 00:05:46,800 --> 00:05:50,520 the biggest error term is gonna be this one here. 96 00:05:50,520 --> 00:05:53,550 So if the curvature of f prime is equal to zero, 97 00:05:53,550 --> 00:05:55,512 if we have a linear growth of a system, let's say, 98 00:05:55,512 --> 00:05:57,960 so f prime is gonna be zero. 99 00:05:57,960 --> 00:05:59,820 Euler's method is gonna do awesome 100 00:05:59,820 --> 00:06:02,343 because this error term is equal to zero, 101 00:06:04,440 --> 00:06:07,080 but for any like non-zero error, 102 00:06:07,080 --> 00:06:08,740 really the key point is that 103 00:06:09,990 --> 00:06:12,930 the biggest term that we have is proportional to h squared, 104 00:06:12,930 --> 00:06:13,950 and that means two things. 105 00:06:13,950 --> 00:06:17,070 That means just as we move from discrete to continuous. 106 00:06:17,070 --> 00:06:21,210 If h goes to zero, if we have a very good computer 107 00:06:21,210 --> 00:06:23,310 and we're very patient and we say I'm gonna do, 108 00:06:23,310 --> 00:06:25,714 you know, infinitely many step 109 00:06:25,714 --> 00:06:29,100 of tiny, tiny, tiny, tiny durations, 110 00:06:29,100 --> 00:06:30,720 then Euler's method is gonna be fine, 111 00:06:30,720 --> 00:06:33,720 but otherwise, you know, it's important to remember 112 00:06:33,720 --> 00:06:36,300 that you're going to have those local error terms. 113 00:06:36,300 --> 00:06:41,300 And often, the difference here, let me put it in blue, 114 00:06:41,340 --> 00:06:43,833 so the difference here is the local error. 115 00:06:46,560 --> 00:06:51,450 And often as in my cartoon, this error sort of grows 116 00:06:51,450 --> 00:06:53,460 with time steps, right? 117 00:06:53,460 --> 00:06:54,484 It might shrink sometimes. 118 00:06:54,484 --> 00:06:56,040 You might be lucky, 119 00:06:56,040 --> 00:06:58,263 but overall you expect it to grow. 120 00:07:00,540 --> 00:07:04,860 And so, we're often gonna say that the global error 121 00:07:07,560 --> 00:07:12,560 of our numerical integrator is the sum. 122 00:07:19,380 --> 00:07:21,363 Let me rewrite that more clearly here. 123 00:07:23,370 --> 00:07:28,370 Global error is gonna be the sum 124 00:07:29,220 --> 00:07:34,220 over all time steps of the local error. 125 00:07:36,660 --> 00:07:37,611 And we had the fact... 126 00:07:37,611 --> 00:07:39,985 So we had this idea that the local error 127 00:07:39,985 --> 00:07:44,313 was an h square for Euler. 128 00:07:48,870 --> 00:07:50,940 Well, this is gonna be equal 129 00:07:50,940 --> 00:07:55,940 to the duration of our numerical integration. 130 00:07:57,840 --> 00:08:00,100 So we're integrating from t equals zero 131 00:08:01,500 --> 00:08:04,353 to, let's say T, capital T. 132 00:08:06,450 --> 00:08:08,142 So how many steps are we gonna have to do? 133 00:08:08,142 --> 00:08:11,340 How many local error are we solving here, 134 00:08:11,340 --> 00:08:12,173 are we summing up? 135 00:08:12,173 --> 00:08:15,873 So it's capital T divided by h. 136 00:08:17,970 --> 00:08:20,280 That's the number of steps that we have to do, 137 00:08:20,280 --> 00:08:24,033 times local error, which is of order h squared. 138 00:08:25,230 --> 00:08:27,453 So this is gonna be an h. 139 00:08:29,430 --> 00:08:31,680 And what I'm trying to say here is that 140 00:08:31,680 --> 00:08:33,030 there's this key thing is, 141 00:08:33,030 --> 00:08:37,380 which is that Euler's method is capturing up to order h 142 00:08:37,380 --> 00:08:41,280 the Taylor series of the true solution, 143 00:08:41,280 --> 00:08:43,351 and it's so that its local error 144 00:08:43,351 --> 00:08:45,688 and what's being ignored is h square, 145 00:08:45,688 --> 00:08:47,340 but the global error, 146 00:08:47,340 --> 00:08:49,470 because you're doing a lot of different steps, 147 00:08:49,470 --> 00:08:52,020 the global error is still gonna be of order h 148 00:08:52,020 --> 00:08:54,540 even though you're capturing the thing. 149 00:08:54,540 --> 00:08:57,213 You're capturing the term of order h. 150 00:08:59,677 --> 00:09:02,726 Really, I wanna highlight this distinction 151 00:09:02,726 --> 00:09:04,606 between local error and global error 152 00:09:04,606 --> 00:09:06,806 because it is kind of surprising to have something 153 00:09:06,806 --> 00:09:09,690 that captures the derivative. 154 00:09:09,690 --> 00:09:12,360 And yet as you integrate a trajectory in time, 155 00:09:12,360 --> 00:09:15,960 you do expect its error to scale 156 00:09:15,960 --> 00:09:18,390 with your step size linearly. 157 00:09:18,390 --> 00:09:21,270 So basically if you wanna do a numerical integration 158 00:09:21,270 --> 00:09:24,420 that's 10 times closer to the true solution, 159 00:09:24,420 --> 00:09:27,390 if I wanted my red that's here to be 10 times closer, 160 00:09:27,390 --> 00:09:29,790 I would need to do 10 times more steps. 161 00:09:29,790 --> 00:09:33,930 But we can have integrator that do better. 162 00:09:33,930 --> 00:09:36,949 So, I apologize here. 163 00:09:36,949 --> 00:09:39,033 I expected a blank sheet. 164 00:09:46,620 --> 00:09:49,770 So we wanna integrate again from t equals zero 165 00:09:49,770 --> 00:09:51,273 to t equals T, 166 00:09:53,543 --> 00:09:55,293 whoops, x of t. 167 00:09:56,940 --> 00:10:01,940 We have something different, true x of t here. 168 00:10:03,117 --> 00:10:04,833 And now we want to do better. 169 00:10:05,850 --> 00:10:08,700 Well, what's the key part that Euler's method is missing? 170 00:10:11,640 --> 00:10:14,160 It's the fact that as you do one step, 171 00:10:14,160 --> 00:10:16,950 your derivative is already changing 172 00:10:16,950 --> 00:10:18,060 during that step, right? 173 00:10:18,060 --> 00:10:20,313 There might be a second derivative. 174 00:10:21,420 --> 00:10:24,930 And so it's a mistake to to project it too far 175 00:10:24,930 --> 00:10:26,193 into the future. 176 00:10:27,960 --> 00:10:30,810 So there is another method, which I've learned 177 00:10:30,810 --> 00:10:33,693 under the name of improved Euler. 178 00:10:34,890 --> 00:10:38,493 Improved Euler's method. 179 00:10:42,900 --> 00:10:46,171 If you Google around, in English, 180 00:10:46,171 --> 00:10:48,870 I believe it's often called Heun's method. 181 00:10:48,870 --> 00:10:49,703 Whoops. 182 00:10:50,940 --> 00:10:52,023 Too sensitive here. 183 00:10:54,180 --> 00:10:57,033 Heun's method. 184 00:10:59,790 --> 00:11:01,770 And this, I'll tell you right away 185 00:11:01,770 --> 00:11:05,793 is a second order method in global error. 186 00:11:07,230 --> 00:11:10,590 So this method is gonna have a global error 187 00:11:14,700 --> 00:11:18,420 that scales of the order of h squared, 188 00:11:18,420 --> 00:11:21,300 meaning that, you know, if you wanted Euler's method 189 00:11:21,300 --> 00:11:23,250 to be 100 times more accurate, 190 00:11:23,250 --> 00:11:25,290 you needed 100 times more time step. 191 00:11:25,290 --> 00:11:28,690 Here, you would only need 10 times more time steps 192 00:11:30,330 --> 00:11:32,853 because the global error scales better with h. 193 00:11:34,080 --> 00:11:38,460 And so that means that the local error 194 00:11:38,460 --> 00:11:43,460 for the same reason as before has to be an h cubed 195 00:11:45,120 --> 00:11:48,780 because the number of steps we're making grows 196 00:11:48,780 --> 00:11:51,600 as one over h as we decrease our time step. 197 00:11:51,600 --> 00:11:56,600 So the local error error and the global error, 198 00:11:56,640 --> 00:11:59,103 there's one difference in order, okay. 199 00:12:00,840 --> 00:12:03,120 Well, what is this method? 200 00:12:03,120 --> 00:12:04,920 Let me just fix my typo here. 201 00:12:04,920 --> 00:12:05,753 Heun's method. 202 00:12:09,720 --> 00:12:13,653 The method itself looks super simple. 203 00:12:15,210 --> 00:12:17,790 What we're gonna say, and I'm going to write it 204 00:12:17,790 --> 00:12:22,790 as xh for Heun at time t plus h, 205 00:12:24,150 --> 00:12:25,810 it's gonna be equal to x of t 206 00:12:27,930 --> 00:12:31,960 plus h f of x of t 207 00:12:33,840 --> 00:12:38,640 plus f of xe time t plus h. 208 00:12:38,640 --> 00:12:41,310 So I'm switching up my notation here a little more. 209 00:12:41,310 --> 00:12:43,860 So let me explain what I mean, 210 00:12:43,860 --> 00:12:46,500 so that the prediction from Heun's method 211 00:12:46,500 --> 00:12:51,390 is gonna be a projection from x of t over a time step h 212 00:12:51,390 --> 00:12:56,220 of the average between the measured derivative. 213 00:12:56,220 --> 00:13:00,600 So this term here, this f of x of t 214 00:13:00,600 --> 00:13:02,150 is the initial derivative here. 215 00:13:03,112 --> 00:13:07,023 And now what I have, this f of xe, let me go back, 216 00:13:09,600 --> 00:13:13,800 is gonna be the prediction from Euler's method. 217 00:13:13,800 --> 00:13:16,840 So basically what you do here is you say 218 00:13:22,380 --> 00:13:24,813 I look at my initial derivative, 219 00:13:26,250 --> 00:13:28,893 I project myself over time h. 220 00:13:34,901 --> 00:13:38,553 Okay, project myself over time h, 221 00:13:40,148 --> 00:13:44,550 so I get an Euler prediction of here. 222 00:13:44,550 --> 00:13:45,870 Well, now at this point, 223 00:13:45,870 --> 00:13:49,200 my derivative here is much faster, 224 00:13:49,200 --> 00:13:52,680 much steeper than it was at my initial point. 225 00:13:52,680 --> 00:13:54,670 So I'm gonna take the average 226 00:13:56,640 --> 00:14:00,300 of both, my first point and my second point. 227 00:14:00,300 --> 00:14:03,150 So my average might look something like this, 228 00:14:03,150 --> 00:14:05,430 and now this is what I'm gonna project, 229 00:14:05,430 --> 00:14:06,730 and I'm gonna end up here. 230 00:14:08,910 --> 00:14:11,430 So basically every step of Heun's method 231 00:14:11,430 --> 00:14:13,290 does one step with Euler's method, 232 00:14:13,290 --> 00:14:15,663 looks at the derivative and average. 233 00:14:16,747 --> 00:14:19,817 The derivative that Euler's would have 234 00:14:19,817 --> 00:14:22,560 for its second step with the initial step 235 00:14:22,560 --> 00:14:24,843 and then does a true first step under Heun. 236 00:14:26,556 --> 00:14:28,650 Let me give another example here. 237 00:14:28,650 --> 00:14:32,190 So with Euler, I evaluate my derivative here. 238 00:14:32,190 --> 00:14:36,210 I project into the future up to 2h, 239 00:14:36,210 --> 00:14:38,283 which would be, you know, somewhere here. 240 00:14:39,780 --> 00:14:42,870 Euler is gonna end up way off base here. 241 00:14:42,870 --> 00:14:45,243 It's a steep derivative, might end up here. 242 00:14:48,330 --> 00:14:51,633 Now would evaluate the derivative here, which is negative. 243 00:14:52,560 --> 00:14:54,360 So Heun would average both, 244 00:14:54,360 --> 00:14:56,730 which would be pretty much flat in this case 245 00:14:56,730 --> 00:14:57,960 and end up here. 246 00:14:57,960 --> 00:15:00,573 Doing much better than the blue dot, right? 247 00:15:02,490 --> 00:15:06,300 So Euler is doing this and this, 248 00:15:06,300 --> 00:15:08,343 and Heun is doing this and this. 249 00:15:09,420 --> 00:15:13,740 And the key part is that the local error 250 00:15:13,740 --> 00:15:16,800 and the global error are both one order of magnitude better. 251 00:15:16,800 --> 00:15:19,350 So if you want to be 100 times more accurate, 252 00:15:19,350 --> 00:15:22,023 you only have to do 10 times more steps. 253 00:15:24,840 --> 00:15:28,560 Now every single evaluation takes two evaluation 254 00:15:28,560 --> 00:15:29,790 of your derivatives. 255 00:15:29,790 --> 00:15:32,850 So every step does take twice as many operation, 256 00:15:32,850 --> 00:15:36,000 twice as many evaluation of this f function 257 00:15:36,000 --> 00:15:38,130 for your derivatives. 258 00:15:38,130 --> 00:15:41,940 But really you're still winning, you know, a factor of five 259 00:15:41,940 --> 00:15:43,710 if you wanna be 100 times more accurate. 260 00:15:43,710 --> 00:15:48,240 So you can have your time steps be 10 times smaller. 261 00:15:48,240 --> 00:15:49,800 You do twice as many operations. 262 00:15:49,800 --> 00:15:54,240 So that's 20 operations for your 100 fold precision, 263 00:15:54,240 --> 00:15:55,260 which is still much better 264 00:15:55,260 --> 00:15:57,663 than what you would do with Euler. 265 00:15:58,845 --> 00:16:00,603 Now as you'll see in the homework, 266 00:16:05,160 --> 00:16:09,090 Heun's method, which is this definition here, 267 00:16:09,090 --> 00:16:13,740 is actually not defined as a simple arithmetic average 268 00:16:13,740 --> 00:16:18,740 between f of x of t and f of xe of t plus h. 269 00:16:21,450 --> 00:16:24,090 The basic idea looks like you're just taking an average, 270 00:16:24,090 --> 00:16:25,320 but that's not what it is. 271 00:16:25,320 --> 00:16:29,670 The goal here, and this is a hint for the homework, 272 00:16:29,670 --> 00:16:34,670 is that you can ask, well, what is f of xe 273 00:16:34,740 --> 00:16:36,453 at time t plus h? 274 00:16:37,410 --> 00:16:39,963 You can develop that with the Taylor series. 275 00:16:49,230 --> 00:16:54,000 And then you can show that this one half is actually chosen 276 00:16:54,000 --> 00:16:58,800 such that this xh approximation 277 00:16:58,800 --> 00:17:03,150 at time t plus h captures one more term, 278 00:17:03,150 --> 00:17:05,010 so captures the h square term 279 00:17:05,010 --> 00:17:07,650 in the original Taylor series for the true solution. 280 00:17:07,650 --> 00:17:10,722 This is something that like sounds weird. 281 00:17:10,722 --> 00:17:13,560 Like your only evaluating first order derivative. 282 00:17:13,560 --> 00:17:16,260 How could you like go and get information 283 00:17:16,260 --> 00:17:18,210 about the second order derivative? 284 00:17:18,210 --> 00:17:21,510 But if you do work it out by using Taylor series 285 00:17:21,510 --> 00:17:26,360 of both x of t, which we did right here, 286 00:17:30,196 --> 00:17:32,746 so this is our Taylor series for the true solution, 287 00:17:33,990 --> 00:17:37,710 and then you go do your Taylor series for this term, 288 00:17:37,710 --> 00:17:41,100 for the derivative itself under Euler's method, 289 00:17:41,100 --> 00:17:42,810 then you can see that you're able 290 00:17:42,810 --> 00:17:45,530 to combine multiple evaluation of your derivatives 291 00:17:45,530 --> 00:17:47,890 in a smart way to capture more and more 292 00:17:49,260 --> 00:17:51,453 or capture higher order terms. 293 00:17:53,790 --> 00:17:55,557 In a future video, so next week, 294 00:17:55,557 --> 00:17:59,700 I'll go into deeper detail in the in the Runge-Kutta 295 00:17:59,700 --> 00:18:01,117 or Dormand-Prince method, 296 00:18:01,117 --> 00:18:04,110 which captures up to order four terms, 297 00:18:04,110 --> 00:18:06,870 and there it's just gonna be a lot of arithmetics, 298 00:18:06,870 --> 00:18:10,080 but we're gonna be able to see that similarly 299 00:18:10,080 --> 00:18:14,042 by doing four evaluations or derivative, 300 00:18:14,042 --> 00:18:16,350 we can get like a higher order term, 301 00:18:16,350 --> 00:18:18,510 and there it's gonna look nothing like an average. 302 00:18:18,510 --> 00:18:21,060 So the fact that you have a simple average here, 303 00:18:21,060 --> 00:18:26,060 this divided by two for both evaluation 304 00:18:27,060 --> 00:18:29,223 of the derivative is sort of coincidence, 305 00:18:30,480 --> 00:18:31,980 but it's a nice explanation. 306 00:18:31,980 --> 00:18:34,590 And as you can see, like in any cartoon, 307 00:18:34,590 --> 00:18:36,360 like the one in the top left here, 308 00:18:36,360 --> 00:18:38,700 it's clear that it's gonna do better. 309 00:18:38,700 --> 00:18:43,700 So, apologies, by the way, if my picture here 310 00:18:44,250 --> 00:18:48,843 was, in the way for some of the words up there. 311 00:18:52,110 --> 00:18:56,160 But, you know, this is a topic 312 00:18:56,160 --> 00:18:58,375 that we're gonna revisit time and time again 313 00:18:58,375 --> 00:19:02,103 because the key part is that even if you ask, 314 00:19:03,690 --> 00:19:05,945 you know, a scientific library, 315 00:19:05,945 --> 00:19:10,470 please integrate my differential equations through time, 316 00:19:10,470 --> 00:19:13,563 it's super important to know what order, 317 00:19:14,940 --> 00:19:16,260 how much error are you getting, 318 00:19:16,260 --> 00:19:18,330 what's the order of the method that it's using 319 00:19:18,330 --> 00:19:20,970 by default or that you're asking it to solve 320 00:19:20,970 --> 00:19:23,670 because what comes out of discrete computer 321 00:19:23,670 --> 00:19:26,040 and discrete integration is not the true x of t, 322 00:19:26,040 --> 00:19:27,660 but an approximation of it. 323 00:19:27,660 --> 00:19:29,520 And as I showed in the cartoon, 324 00:19:29,520 --> 00:19:32,223 those approximations can be way off. 325 00:19:33,510 --> 00:19:36,029 So it it's gonna be important to distinguish error 326 00:19:36,029 --> 00:19:38,015 due to our model specification 327 00:19:38,015 --> 00:19:42,723 and error due to how we solve the model numerically. 328 00:19:46,230 --> 00:19:49,068 And one way to test how well we're doing 329 00:19:49,068 --> 00:19:51,780 is gonna be to compare our predictions 330 00:19:51,780 --> 00:19:53,580 from the mathematical models 331 00:19:53,580 --> 00:19:55,200 with simulations of the results. 332 00:19:55,200 --> 00:19:58,380 So in the next video, we're gonna see how to use 333 00:19:58,380 --> 00:20:00,090 some of the tools we quickly saw 334 00:20:00,090 --> 00:20:01,800 to simulate discrete models, 335 00:20:01,800 --> 00:20:05,160 but this time in continuous time. 336 00:20:05,160 --> 00:20:06,560 So I'll see in the next one.