 The next website is up. There was, as many of you got an email, there was a problem in assigning the bonus points. So I hope most of you realize that if you did the homework early, you got bonus points, and if you did it on time, you just got regular points. Unfortunately, for some people, they were getting bonus points, even if they did it two minutes before it was due. I mean, that was fortunate for them, but it seemed unfair for the people who were not getting it. So for the first three assignments, I gave everybody the bonus points as long as you did it in time. But that means that we can't really do the bonus points anymore, because it doesn't work. About 20% of the students were getting extra bonus points, which wasn't fair the other eight years. So everybody got half again the number of points for the first three assignments, but then we're done with that. Okay, for homework number three is not quite up on the website yet, because I haven't changed it, because we're really behind schedule. But it will be up, but it won't be new until after Rosh Hashanah, because most of you don't have recitations. We will have one recitation next week, because there's no class on Thursday and Friday. So it will be due the Monday. And then, of course, there's this midterm thing, which is two weeks from yesterday at 8.30. It will not be in this room. Most people will be in urgent space, but one recitation, I think yesterday Cha's recitation will be in old engineering. I think that's recitation seven? I don't know, anybody know? No, 8.30pm, but what recitation? Nobody in here is in Cha's recitation? Yeah, is that seven? Number seven? You don't know. Once Cha's in, Cha's in your recitation probably will not be in the essence. But I'll write this down, it will be on the website soon. Okay, so what we did last time, if you remember, and where I'm thinking not from, is we had this, so we had an integral that we, for whatever reason, cannot or don't want to calculate the actual formula for. So a lot of examples are that way, I gave several examples. And so you want to do this numerically. And really, we have three methods of choice. There are more, but we have the trapezoid, we have the midpoint, and we have Simpson's method. I don't know why one's a rule and one's a method, but okay. Let's not even give them methods. We have trapezoid, midpoint, and Simpson's. And I went through this last time. The trapezoid, the trapezoid, this, that's supposed to go under. You fit trapezoids underneath as you add up their areas. The midpoint, you fit rectangles underneath, rectangles that don't go underneath, they go through their middles. And then Simpson's, which I can't draw very well, you go through three points per thing, and you put a little parabolic guys on top. There's a formula for them. The trapezoid one, you evaluate here and here, the heights, and you average. Here and here are the heights, and you average the midpoint. You average, and you evaluate in the middles. And Simpson's, you take one of these, four of these, and two of these, and you add them up in that way. If you look at the formula, it's called this Tn, this one. S, and I'm going to call it S2n, because of this issue that I will. We use sort of more points and it depends on what you put a column in. Then, in fact, Simpson's rule, if you just look at the formulas that you get, which I didn't say last time, Simpson's is just a third of a trapezoid plus two-thirds of the midpoint. I didn't clean enough room to try this again. So if I calculate the midpoint method with five rectangles and the trapezoid method with five rectangles, and I take my answer, and I take one-third of this one and two-thirds of this one, then that would give me Simpson's, where backwards? I think Simpson's is fewer. Does anybody have a clue what I'm talking about? Okay, so then you shouldn't have stopped me like ten minutes ago. All right, so this you understand, right? I don't need to review this again. Yes? You don't understand. Okay. Well, if you shake your head, it means no, unless we're in India and then it means yes. Okay, so I think that's right. Anyway, if you just look at this, you see if I take this guy and I take one-third of the answer that I get from this rectangle, and I take two-thirds of what I get by just evaluating at the middle, then that should give me something about this, this, and this. But the numbering here is a little bit funny because the way we use the number n does not count the number of rectangles that counts the number of points, for instance. So this is right. Okay. Does anyone need me to write down the formula again? Yes? Yes. Just figuring out the reason. Okay. So the trapezoid m is, so we take the width of the little interval, so I'm integrating from b to a to b. So I take the width of each little rectangle that I take, and then I want to average, so I pick my n points going, I'm just really n plus one because I started zero, and I evaluate my function at the first point, at the second point, and at the last point. So here I have n plus one points. This is the height from the right to the left of each rectangle, and I'm going to average them, so I have to divide by two. And I'm sorry, I take twice those. The reason they're double is because when I have a trapezoid like this, sitting next to a trapezoid like this, this guy whose height is f of x1 is counted twice. So I get a two for everybody in the middle because you count it from the right, you count it from the left. In the midpoint, I take the width of my rectangles, I just take the heights, let me call them m's instead of x's. Picture room for symptoms. Here I have xn, or not n, I have my interval, I chop it up into a bunch of rectangles, this side x0, x1, x2, until I'm done, xn. And I'm going to call m1, m2, m3, and the midpoints of those rectangles. And then the heights over it are plug this into the function. The midpoint formula is just take the width of each rectangle, this distance here is e minus a over n. It's really e minus a over n. That's the width of each guy. For trapezoid, I have to average the midpoint, I just did that. But the thing that's annoying about midpoint is that the numbers are bigger because I have to divide by the finite midpoints. And then for symptoms, which I didn't leave room for, for symptoms, I'm going to use that same notation. And so, and now just due to convention, if I have, and again, about n points, I'm going to use exactly the same points. And what I want to take is the width here, and then I'm going to average these two things in sort of a funny way. So I'm going to take the function at the extreme right side, this side, which is that right, way over there, the lowest value. And then I'm going to take four of the midpoint. And then I'm going to take two of the left side, which is also a right side. And then I'm going to take four of the next midpoint. I'm going to take two of the next side. There's f's here. And two of the next side and so on. And then when I get to the end, I will be taking two, the last guy, plus four of the last midpoint, plus just one of the last point. And then this averaging that I'm doing, because I have sort of three points for each rectangle, instead of two points for each rectangle here, they're not rectangles, each interval, I divide by a third. Because when you average three numbers, you divide by three. When you average two numbers, you divide by two. And if you look at these formulas, you can see that this guy is just, well, if I double the n, this guy is just that guy with fewer, plus that guy. That was a lot of discussion for something not really very worthwhile. Okay? Yeah. Do you want to use q's or smiley faces or rabbits? Use whatever letter you happen to like. The reason that I switched from x's to m's is if you think about rectangles, if I think of this as a rectangle, I have a right side, a left side, and a middle. So I use right and left for x and m for middle. But if I'm thinking of twice as many points, these are all the same. Use whatever letter that makes more sense to you. The process, so I will go through one more example of this. Yeah. So the reason it's 4 and 2 and 4 and 2 and blah, blah, blah, is because I want to count the middle more. You can, and I just shouldn't have done it. I really don't have time. I want to find a parabola going through three points. When I'm finding a parabola going through three points, the middle counts more than the two sides. That's why it's 4 and 2. The middle is twice as important as the two sides. And so, and because everything's double, that's why it's 4 and 2. But you could just, if I just solve the equation, I don't think it will help. So, and it'll take about 15 minutes, I don't want to do it because I'm already waiting. Okay? So it's just 4 and 2 and 4 and 2 and I'm sorry that's not very important. Okay. That's not what I'm talking about today to Beth. We have these bounds on the error that tell us how good these approximations are, which I of course have not memorized and you don't have to memorize it. But the error, so let me just call it, I don't know, I don't see it yet. So, E sub t, which by that I mean the difference between the trapezoid and the actual value. So this is always less than the width of the interval to the third divided by the number of points you're using squared and I think this is the 12th for the trapezoid. That means that's how far off the trapezoid is. No more than that. It could be exact but it's never more than and it's a constant. This constant is the maximum of the second derivative over the interval. I'll do an example of this in just a second. The error on the midpoint is less than the same thing. b minus a, 2k over 24 n squared. And Simpson's rule is magic because Simpson's rule for twice as many evaluations you go from the square to the fourth. So I'll just write it here. For Simpson's rule this is less than b minus a to the fifth and then this constant here, I'll use the k so I'm going to use m over 180 n to the fourth where here m is the maximum of the fourth derivative. So what does this mean? I'll do an example. So suppose you do an example in Simpson's because that's maybe the most complicated. And rather than doing some magic rule I can't do let's do something I can do but only with a four function. I'm going to do it sort of by camp. So suppose for some reason I don't know why you only have a four function calculator or you can only multiply and you want to calculate the log of two. Three places, four places. So I do log three instead. Let's do log three. Doesn't it? Does anyone know the log of two? Is anyone here? So it is addition, multiplication, and division. I guess I could subtract if I need to but that's really addition. And I want to calculate the log of two to three places. What do I do? Nobody knows. It's impossible. I take out my calculator. Again. Right. One, two. Great. It's zero. So I know that the integral of one and two of one over x dx is the natural log of x evaluated from one to two which is the log of two minus the log of one. And one of the things that you're supposed to know is that the log of one is zero. So that's the log of two. So that's nice. I know that the logarithm is the integral of one over x and so now I have a formula but I only get to use addition, multiplication, and division because the log button on my calculator broke. And so, or I was thrown back in a time machine and it's the 17th century and we need to calculate logarithms because Isaac Newton just asked me and what it means. So now we can do this and I want it good to three places. So I'm going to use Simpson's rule because it's really the most efficient. I don't want to do too many multiplications in division. So I know Simpson's rule is going to be the least amount of work for me. So what do I do next? How do I know whether I use n equals five or n equals 10 or n equals 100 or n equals four? How can I know? All the required information is on the floor. So what do I do next? I'm going to draw the graph, okay. Here's the graph, one over x. I want to go from here to here, one to two. I want that area. So I suppose I could cut out a lot of little pieces of paper and measure. Getting that to three places, probably I'd have to draw the graph exactly about the scale of this room and then measure where I can use a micrometer but I don't have a micrometer, so that's not going to help. Okay, so you have someone starting to tell me another. Maybe I'll draw a bigger graph. So what's next? The information is on the board. Everything you need. You just got to do some calculation, yeah. So suppose I just picked a value for n. Pick a value. 10? 4? Okay, suppose I pick a value for n for 4. I get an answer. Have it right. Because if it's not right to three places, my aircraft will crash. My bridge will fall down. Whatever it is I'm doing, they're not working. So I have to know it's right, but I don't know the answer. I don't have a calculator that can tell me the answer. So I could just pick and hope beyond hope that I was lucky. I could pick n equals a thousand and sweat a lot if there only to learn the two would have been enough. And maybe a thousand wasn't enough. Maybe I needed the 10,000. Is that right? Somebody just said it. Is the error right? So I know already right here, well right here, from this formula, how to figure out how good it's going to be. I've got a piece of division in John, but this formula tells me. So lucky for me, a is one and b is two. So b minus a to the fifth. So my error, my Simpson's error, is less than two minus one to the fifth power. Well that's easy. There's a number n that I don't know yet. 180. I know what 180 is. And n to the fourth. And I want this error to be less than I want it good to three places. So I want this less than zero, so this is what I want. Zero point three places and then round. So one thing here is when I say good to three places, I want the third digit after the decimal point to be correct. That means I can have a mistake in the fourth digit after the decimal point but it can't be bigger than five. Because if it's bigger than five I'll round it the wrong way and my third digit will be wrong. So I want my error to be less than 005. Okay? Is everybody okay with that? So now we just need to figure out what n is and then I have an equation for n. So what's m? Well, m is the maximum of the fourth derivative. It's 180. I wrote 120 and then I checked it was 180. I changed it to the very end of the class. It better be 180. Let me check it again. So you may have noticed but not really very good with actual constants in 180. I have a very terrible memory for numbers. I'm actually not very good at adding either but okay. So here we are. I'm terrible at math. I'm bad at arithmetic. Okay, so here we are. So I have to figure out what m is. So m is the maximum of the fourth derivative. Well that means I need to take some derivatives. So as of x for x the first derivative is negative one over x squared. The second derivative is negative two over x cubed. The third derivative negative six. No, it's positive now over x to the fourth. Oh yeah, this one's positive. This one's negative. I don't care because I'm thinking of absolute value but okay. And f to the fourth is positive again. It's 24 over x to the fifth. And now, so this is a function but I want a number and I want the number here that makes this the biggest. The graph is a little screwy looking. I want the number between one and two that makes this the biggest in absolute value. So I want x to be one when x is four when x is one and it's 24 over 32 when x is two. So 24 is bigger than 24 over 32 so that means I take m equal to 24. Now I can get a useful answer even if I can't figure out exactly what the maximum is as long as I take something bigger than it. So if I wanted I could take m equal to 100 and get something that would work or maybe I'd do extra work. So I want to take m equal to 24 but then when I do my calculation I may change to be bigger. Okay. m is 24 and so now I need to solve and I need to find an n so that one over 20, forget about the one, 24 times one is usually 24 over 180 n squared is less than 0.0005 which maybe I can write as 5 over 1 over thank you that's a 4 5 over 10 thousand. So I need to solve that. So that's the same as saying n to the fourth other than 24 times 5 over 180 times something's wrong here my 10,000 and my 5 run on the wrong side 24 1, 2, 3 is it 10,000? Oh I see it. Okay. 24,000 180 times 5 so let's see we can reduce this a little bit I suppose so of course if we have a calculator we can just calculate it are we in the 17th century or are we in the 21st century? In switch we can go back and forth so somebody want to calculate this one? No? Nobody has a calculator? So if I 80 over 80 over 3 this is about well so let's call that 90 over 3 so that's less so this equals 80 over 3 this is 90 over 3 so I'm going to call that what's the wrong way? Alright 80 over 3 which is 20 what's 80 over 3 goes into 80 2 times then 3 goes into 27 times it so this is 16 and change those numbers 26 and stuff so I need to find a number n whose 4th power is bigger than 26 well let's see the 4th power of 2 is 16 no 2 isn't going to work the 4th power of 3 is 81 3 works I'm cool so here I take n equals 3 but it needs to be even but since we're going to do Simpson's method I have to have an even number of rectangles so I better use so I need n equals 4 because Simpson's rule doesn't work with an odd number n so that means two intervals is good enough for Simpson's rule to give you a log to 5 places so that means I need to calculate with 5 points so I need to take the inverse of 5 numbers and you blow the entire glass that's always good but it's good because the other lecture she's behind but I write the test so that I can do it without a calculator and if I can do it without a calculator you can for sure do it so there's a lot of things that calculators are useful for and I carefully choose the numbers so that you can do them without okay so we do my n equals 4 so for Simpson's rule with 4 I'm going from a to b that means the width of each of my rectangles is 1 quarter so I have a third times a quarter and I'm going remember from 1 to 2 and I'm going to put I'm going to find 4 points between 1 and 2 the first one is 1 the middle one is 1 and a half which is called 3 halves the last one is called 2 and then the middle between 1 and 3 halves is 1 and a quarter which is yes 5 fourths and the middle between 3 halves and 2 is 7 so those are the points those are my x0 n1 and x oh this is 1 and a half this one is 3 fourths between 1 and 1 and a half is not is not 3 fourths half of 1 and a half is 3 fourths it's 1 and a fourth which is 5 over 4 or if you prefer 1 plus 1 over 4 and this is 1 plus 3 over 4 okay so now we do the stuff we add up this is evaluated here that's easy 1 over 1 is 1 plus 4 times the function evaluated here so this is 4 fifths because my function is 4th bit plus twice the function evaluated here plus 4 times the function evaluated here plus that's 1 of the function evaluated there and so that gives me my approximation and let me not do the arithmetic because I'll blow it yeah because my function is 1 over x so if you prefer let me just draw another line so this is 1 12th of 1 plus 4 times 4 fifths plus 2 times 2 thirds plus 4 sevenths plus because my function is 1 over x where did you go there you go so my function is 1 over x and then this is some number so you can do this arithmetic I will blow it so I'm just going to stop it so I feel confident that you could do the same thing if I ask the question which trapezoid is to say trapezoid or midpoint it's the same process but you only need the second so my constant K for trapezoid or midpoint is 2 but I'm only taking the square root instead of the fourth root so it's a bigger number okay it's something like maybe it's 4 okay so let me let me just start the next screen so I'm going to ask a different question now and I was all set up to do quickly but so any questions about this will be good with this what you want to count so if you are counting the number of intervals or I will come so you notice that in Simpson's rule I have two things with parabolic tops but I have four points so it depends on who you can talk to so the book's author prefers to count the points I think as we read the Wikipedia article it prefers to count if it's not Wikipedia it prefers to count the number of intervals and so in this case in this case and I would get I would call it n or n equals 4 yes to change the formula if n is the number of intervals then instead of the third it's a sixth apple fry and you have more stuff in it depends on what you want to call n oh shoot so here yeah this is n2x it's not a commitment to the interval it's the distance between the four because we want to say it over 2 n in this case the distance from here to here is 1 quarter this is from the first point to the next point which happens the limit of it is 1 quarter so I divide by 1 quarter this is correct I'm not really sick of it so as I'm looking at the interval it looks like this and it goes way up it gets really small probably I can't the battery is dead so I just have to talk like this now ok because we only have 5 minutes so I'll shout for 5 minutes it's fine so I'm doing an interval like this now as opposed to the minus x evaluated from 0 which is minus e to the minus 10 plus 1 minus e to the minus minus minus e to the minus 0 which is 1 minus e to the minus 10 this is a tiny number if I was instead going to 10 I go to 100 even tinier number that if I let this go forever I never get bigger than what e to the minus x and all is less than 1 in fact we know what it is it equals this goes to 1 we can make sense the means if I had it infinitely one gallon of paint to paint one square unit but with paint it would 1 gallon even if it's infinitely long because it is so skinny we can make sense of this and it's not just e to the minus x we can make sense of this for we can make sense of this for other functions as well such a thing is called improper integral and make this improper it was improper if we do the other one too because it was improper like ok so we have this improper integral here so an improper integral means that it's infinitely so in general the notion of improper integral is one of the bounds is infinite infinity as the upper bound code if it doesn't exist the limit doesn't exist so for example if you limit the integral from 1 to infinity of x dx this limit doesn't exist so we would say that this diverges but if it exists it converts we're going to use a lot of things we should get used to these terms now because in about 3 weeks we could use them a lot more so if a limit doesn't exist or is infinite we say the integral diverges probably a good place to stop so