 print your report and staple everything together in one thing and make sure the first page has your name and then put it outside of my door. That's engineering 271. It's the second floor. Go as far east as you can. And I want to say a few things I've heard. Well, first of all, I'm hoping this is going to be the future here of the tablets, but because I'm having too many problems with the one I'm running, but so that's enough advertisement. Okay, so any questions about publishing this? Has everybody was able to at least run this commands in a file? And then, well, as I said, just you didn't have to do anything but just copy and paste the M file, which is a format, right? No, everybody's passed that step. That's good. Let me, yeah, I can type. This is incredible. Okay, so one thing that came up, we talked about last time about sensitivity to a certain parameter in this case was, okay, so I just ran the whole file, but I don't really mean to. One order of caution is if you have the cell mode here, which is by default enabled, so you can run each cell one at a time. Don't just go in randomly like in the cell that you want to evaluate and start there, because the previous cells may contain the information needed for this cell. So if you're not sure what you need to run to start running, for instance, if I want to just focus on this sensitivity, then I have to go a little bit up. Can I start here? I don't have the X defined, so the X is defined previously, right? So the way I wrote this code is that it needs to run. You need to start from the beginning. If it didn't need anything from above, then you can, and if you start fresh, so for instance, you clear all everything. So right now, my log has nothing about what I've done before, right? You just open it. Then if I run here and I run this cell, you see it already tells me. So not a reason to get frustrated, it just means you have to go, you know, where it was defined, okay? So here's where it was defined and you run it. And you know, it's not the most efficient way, of course, but one thing that I want to point out is this. When you start doing sensitivity, so you have a parameter that you want to change its value and analyze the dependence on that value, the function that needs to be optimized, in this case, maximized, obviously depends on that parameter, right, as well as X. The nature of the function X is the function as a function of X is pretty much the same. It's a parabola pointing down, right? But the location of the maximum, the vertex, changes, you know, becomes a function of R. And that's the sensitivity that you're competing. So what you do here is you solve, you find that X coordinate of the vertex of that parabola that moves with R, okay? So in one of the homework problems, it asks not only for the X coordinate of the vertex, but also for the Y coordinate of the vertex. So if you need to do, if you need to do sensitivity of the Y coordinate of the vertex in terms of R, then what do you have to do besides computing the X max? Y max, Y max R. And that's done by, I just give this name, is substituting in Y the variable X with what value? With this value, X max R, which was computed for the previous, right? So if I'm now running, remember now I have everything, I run everything once, so X is in there, so I can just run this cell. Then you can see the X max R, right, as a function of R, as well as the maximum, whatever it was, profit, right, as a function of R, right? So this subs, can be done not only for substituting numerical values into the variable, it's done here, for instance. But you can also substitute symbolic variables, right? X max R is still a symbolic function of R into that, okay? And then you do sensitivity to that. By the way, you don't have to do this piece, right? Remember what I said? That was just kind of an extra thing to see a table of values, right? But when you focus on a problem like, let's say first or fourth problem or something in a homework, you don't just copy the whole code and you start modifying it, right? I would say, just look at whatever the parts of the code are relevant for that problem, right? Or ideally, just close your eyes and do it, you know, that's appropriate for that problem, right? Do a piece of code that's appropriate for that problem, okay? In other words, change the name of the variables if you need to, right? I mean, if it's, if the parameter is not R but is A, right, then don't use X max R, right? Invent a different name, right? Just something that, so you have to kind of be able to keep track of what the code does at each line, okay? So for instance, this piece, just unless, unless you want to see that kind of table, right, of values, then you may not need that piece of code. And then just here, you would do sensitivity to, by the way, you can copy pieces of code and run them in the command window if for whatever reason that's more convenient, right? Or you might be able now to, to start changing, like you can do Y and get the sensitivity with respect to the, of the, of the maximum profit with respect to that parameter, right? Now, what I, what I just did is I actually worked in the command window, which it's fine to do it once just to kind of clarify, you know, in your, in your mind how to do the sensitivity with respect to this, I mean, of this value of this variable with respect to R, but, but in the end, it has to get into the file, right? So the commands have to get in the file so you can publish them, right? Otherwise, nobody will know that you've done it or what you've gotten, right? Worst case scenario is, is if you're still having trouble is do whatever you do and just write by hand, but, you know, it's just, I think eventually that won't really work, okay? So what's, what's the sensitivity mean, for instance? What's this number mean for that peak problem? This is a ratio between relative changes, right? Between the quantity that you observe, right? I said the conclusion, whatever of the model is to that parameter. So this just says what? The ratio is, is negative. It means a relative increase in the parameter makes a relative decrease in the, in the maximum profit, right? Also, it says what? It says kind of, kind of what that relative change, 10% relative change in R causes, what? 1% 1.4, 1.5% change in the maximum profit. Yeah, but if I pick 10%, so you have to imagine a fraction that has 10 in the bottom, what has to be in the top to make 0.14? I think it's one point something, right? See what I mean? If, but again, it was a question like, why do we always pick 10%? It's just kind of easy that comes to mind. I mean, of course, it's not, as I said last time, this is not accurate for large, even 10% could be very large variation in the parameter, right? Maybe we should say 1%. But then if you say 1%, this would be 0.1%. And it becomes really hard to say, is it sensitive or not sensitive? You see? When you, at least when you say 10% change, it becomes 1% change. That's not so sensitive, sensitive, right? After all. So, so this maximum profit is not that sensitive to whatever R was, right? The number of days is sensitive, but if you're, you know, if you're really interested in the, in the end, you're really interested in the profit, right? Then it's, it's the actual profit, maximum profit is not so sensitive to that, to that parameter. Let's see. Two things about the problems in the homework. Let's see. How many of you have tried, you know, tried some of them? Okay. So any questions? I mean, step one is usually the hardest, right? Yeah. Yes, please. Okay. So, so, right. So now I'll, I'll, we'll talk precisely about that example. But let me just say this, that each problem has a, will have a certain peculiarity. So there's going to be something that you probably kind of, you don't feel comfortable because you haven't seen it before. And in this problem, you have that situation where it says the number of sale increased by a certain, at a certain rate, depending on the number of rebates, right? So the, unless you're, you've worked in the car dealership a lot, it will be a little bit uncomfortable, I guess, to translate that. So let me just, well, let me say that there is not one is correct approach and then the others are wrong. Okay. So there may be several of them, but the one that I, you know, I kind of think about is the following is if you have certain, so a certain number of sales leads to this profit, right? Per sale in profit, right? Okay. And we don't know what that's not given to us, what that number of sales is. It just says this are the sales that when they're, you know, when they're done, when they're closed, we get this much profit. And the information that's given to us is that for each rebate of $100, that causes what kind of rebate, what kind of sale? The sales increased by 15%. So how do you write that? Well, it's whatever this number is, let's call it N naught. It's going to be N naught plus N naught times 0.5, 0.15, right? So it's N naught times 1 plus 0.15. Okay. So this is $100 rebate. Now again, this is, this is, I don't know, this is by market analysis or something, right? It's usually kind of an assumption. And a further assumption is that if you double that rebate, you're going to another 15%, on top of the first 15%. Now that's debatable, right? That's really the, it's kind of something that, so a $1,300 profit, I mean, you will actually, you're getting $1,500 profit, but if you're given $200 rebates, that's going to create another 15%. So this is N naught times 1 plus 1.5 times 2, right? And so forth. So, right? So I'll let you conclude what the formula should be, but clearly the variable is the number of rebates or the amount of the rebate, your pick. Okay. You see the, many times you will only realize that you've translated it wrong or not as it's really meant to be in reality or how it's actually meant to be in the situation that you described, only when you are at the end of your model and you're drawing conclusions, right? And so you may actually come up with some sort of different equation and then you end up at the end with some conclusion that it's just not right. Okay? For instance, that, but even that, it may not be very clear that it's not right, right? So that's kind of, I mean, you may end up with a conclusion saying which is not this case, but that it's better not to give any rebates. In fact, it's better to increase the price or something, like charge people for whatever, just to increase your profit, right? Which is not very in common, I guess. Okay? But yeah. Right up there is, you have a certain number of sales, but how to read it in the book, it says it makes the profit of $1500 on the sale of a certain model. So I almost want to take, you know, and not to be one. So I want to be a call and I'll make this number. Right. Exactly. So, so when you get to profit, now the profit is going to be a number of sales, right? Which is n times whatever, the amount of rebates, right? So it's going to be whatever, you see, it's always going to be n not times what it is per sale, right? We increase per sale. So it's going to be this quantity multiplied here and then of course the amount of rebates is whatever that is, right? Now, again, I didn't say what, so you have to decide, do you want the number of rebates to be the variable or you want the amount of rebates to be the variable? It doesn't matter, right? But that's going to plane here and then your function to be maximized or minimized is going to be a constant multiple of a function that doesn't depend on this. So for maximization purposes, it's safe to just drop that, right? And then think about profit per sale, okay? So yeah, that's exactly. So in problem number seven, the only difference from the standard, the big problem is that is the profit per day. So it's a ratio between the profit you would make total, right? When you sell divided by the number of days you kept, right? And so it's just a different function, okay? And in fact, the number of days was the variable, right? X. So this should have been, the number of days is X plus the 90 days that you kept. So that's where that piece of information enters. And of course, also the numerator is going to change slightly because there was some fixed cost that's occurred in the first 100 days or 90 days. Yeah. So this really should just, the call should be sort of, it's already there, you just need to modify the function in that call, right? That's all. Okay. All right. So any other questions? All right. So let me kind of start chapter number two. So in this chapter, we're going to move from one variable optimization to two or multivariable optimization. And when you have multivariable optimization, you probably know that there is, there are issues of where the function is defined, you know, if it's defined on some bounded region. So this really is called three stuff. So let's, let's, let's imagine a 2D scenario where I have a function of two independent variables. So f, function of two variables X1, X2. Then the best way to represent this is through, it's a surface, right? And or let's call it Z, something like that. So then the graph is going to be some sort of a surface, right? Assuming f is nice and smooth. And to find the maximum or the minimum, you would have to do what? So first look, first look inside of your domain, right? For critical points. Critical points are points where the gradient is zero. So the partial derivatives are zero, right? The tangent planes are horizontal. So inside, so X1, X2 belong to some region R. Let's say this is the region R, right? So inside R, we're going to compute the gradient or solving the gradient equal to zero yields the critical points, right? So what does this amount of, this basically means partial derivative of f with respect to each variable is zero. So that's a system, right? They need to solve. And that may actually not be easy. So that's another reason why you need most of the times you need a computer. But this is not the end. Once you find the critical points, you need to do what? How do you do that? So the second derivative test. So let's say that we get a solution that's, I'm going to put this hat. I don't know if you've seen it. I mean, if you use hats or tillers or whatever, but this is going to be a critical point. Second derivative test for local max minimum is the second. So it's just look at the Hessian, right? So the second derivative of f with respect to X1, second mixed derivative X1, X2, second mixed derivative X2, X1. And second first derivative with respect to X2. Okay. And again, Calc 3 tells you that X hat is local mean f. Anybody on second row or higher? f. Let's see. So first of all, not only that the determinant has to be positive, but also that the first derivative here has to be positive. That's a minimum, right? What's the best way to remember this? Think of the paraboloid, right? X1 square plus X2 square. That has a minimum, right? What's the Hessian determinant? So it's 2002, right? So it's a positive. So that gives local minimum. How do you have a local maximum? Right? So if the determinant is still positive, but the entry on the first corner here is negative, right? And X is a saddle if the determinant is negative. All right. So and of course you can write this f X1, X1, f X2, X2 minus f X1, X2, f X2, X1. But these two are the same. So you could just square the mixed partial derivative, right? Of course, if f is continuous, then it has all nice derivatives. So all right. So then you decide and you found basically the local maximum, local minimum. And then you also have to look at the boundary, right? Of the region. And decide if there is anything that's higher. So it can actually get messy, right? Because on the boundary, if the region is like a rectangular region, you have four pieces of the boundary. You have to do parentization, right? It's actually quite, you know, it's just just a lot of kind of mechanical work. But the idea is clear, right? You're looking for the highest point on that surface. You have several local maxima, you look for the highest among the local maxima and the points on the boundary. Okay. So we'll start with kind of simple examples. But that's goes into the stuff that we didn't, you know, you didn't count three. Okay. So how about a specific situation? So the example is, you know, no longer farm situation, but it's manufacturing. So color TV problem. And I have the code here and I have the published version. So let me just copy it in Matlab. But by the way, I don't know if you've noticed there are some little colored things here that you can, well, first of all, this thing is not green. Green would mean everything's fine. The code is perfect, right? Well, at least Matlab recognizes it. But if it's not green, if it's yellow, it means there are some errors, not terrible errors, so you can still run the code. In other words, you can make an error like a misspell, then this should turn red. Well, maybe that wasn't bad enough. But I think if you do some sort of, I don't know, like, this is red, right? So if you have something terribly wrong in the code, you're going to get an error. If the code is going to give an error, you're going to see this red. That's a very important thing when you publish. So I saved it, but now it's going to publish. And what do you think is going to happen? You don't see an output. So that's actually important. If you turn in your homework and there's nothing like an no output, no pictures, no output, means what? The code has an error, right? So don't send something that has an error. Yeah. Yeah, just there's a publish button here. There's a publish button that, again, once the code is in this format, it will distinguish the cells so you can kind of browse like an HTML file. This one here. Okay. So that's, yeah, so this is 2009 A, then you go to file and it says publish. It's interesting. Has anybody run into this problem before? Yeah, I went to file but I don't see publish. I think you have to be in editor mode. Where is editor? Oh, yeah, it is in the publish. Okay, so in an editor, it's, you look in the editor. Okay. All right, doesn't make sense with this color coding, which is kind of useful. And again, if it's not, so this was an error, right? This is not what MATLAB uses for defining things. It's just equal. But even if it's yellow, there might be hints or, you know, to, for instance, if you don't terminate it with a semicolon, right? I don't know why they care, but they just kind of, they tell you that, you know, you might have not wanted that because it might look ugly, you know? So anyway, all right, so here's a problem. In a few words, I don't want to spend too much time on the, on the actual description. But in summary, you have, you have a manufacturing plan that, that is doing two types of TVs. And I think now it's old fashioned. 19 and 21 inches is almost unheard of, but okay, 55 and 75 inch TVs. So two types of TVs. And each has a certain price, selling price, and each has a certain cost of manufacturing, right? And not only that, but there is some sort of cannibalism between the two types. So if one, let's see, what's that? There are some rates at which the selling price of one type drops if, if there are too many of the others on the market, right? So they're, they're not on the market, but being sold. If, if the 19 inch, I'll say with the 19 and 21, if the 19 inch set is being sold in certain amount, that forces the price of the 21 inch to drop. Okay. And that rate of drop is assumed to be linear again. So for each, so what's the actual wording just to, because interpreting this, this wording is important. So what do you say? It is estimated that for each type of set, the average selling price drops by one cent for each additional unit sold. So throughout this book, when we say for each additional thing, we mean what? We mean that if it's one is going to drop by that amount, right? If it's two is going to drop by twice that amount. So it's a linear dependence. Now, that's just a model. You could, you could, in reality, it's probably not, nothing's linear in the world, but that's sort of the first simplified model. Okay. So, so how does that translate? Oh, and not only that, but furthermore the sales of 19, that's what I was saying before, sales of 19 inch sets will affect sales of 21 inch sets again through some rate of drop or price drop. Okay. So, so if I call S to be the number of 19 inch sets built and sold and I call T to be the number of 21 inch sets, builds and sold and we call P. So again, we're still in step one, right? So maybe I should still step one is to just digest this situation, this problem. The selling price, P is the selling price for 19 inch sets, set one set and Q is the selling price. There's no number here. It's just selling price for 21 inch set. Okay. And the main assumptions, well, I guess what are the variables? To get a clue on the variables, you look at the question that's at the bottom, at the end, right? What is that question? How many units of each type of sets should be manufactured? Right? So the variable should be, well, probably S and T, right? Again, you might need to revisit this as you develop the model because it might be more advantageous to work with other ones, right? Other variables. But for now, I think it should be clear that these two are pretty much independent of each other. Not independent, but the decision that you have to make on how many of each, right? Could span a whole region in the ST plane. So you could say I'm going to build this many of 19, this many of 21, right? And then see what the profit comes up to be and then tweak those numbers S and T to get, hopefully, a better profit. Okay? So how about these two variables? I mean, this, I don't even want to call them variables anymore, right? Remember what we talked about? We said in step one, we decide on what are our variables, parameters, and constants, right? And the function to be maximized or minimized, right? But the function should depend on those variables. So if we have this sort of, as our variables, then we'd like to, the first thing is, can we express these quantities in terms of the variables? So, and the assumption is, I mean, the assumption, the text is clear, right? It says, I think the 19-inch initially has a fixed, has a set selling price of $339, which now buys you about a 32-inch or something. But then this price drops every time there is an additional unit build, right? So there's a question of timing here. Between the time you buy, you build it and the time you sell it, everything here is assumed to be like instantaneous, right? It's like everything you buy is going to guarantee to be sold at this price, which, again, it's doubtful, but, and, but nevertheless, it's kind of funny, right? Because, I mean, we're talking about situations that are told, I mean, really are not realistic, right? I mean, in reality, the life is much more complicated, okay? The thing is, if you start worrying about every single detail that you know happens in reality, you'll never be in any model. You'll never draw any conclusion, right? So that's why I sort of, it's just stripped down, like, to bare bones almost, you know, shamefully. I mean, just, just, we're going to ignore everything, you know, most everything. We're going to try to come up with one conclusion, and then we're going to revisit our assumptions. Okay, so what is the cost of manufacturing? There was some fixed cost, $400,000, and then each set, a 19-inch set is $195, one each 21-inch set is $225, so it's $185S plus $25T, okay? All right, and the objective? Maximize profit. And profit is revenue minus cost. So what's the revenue? Well, the revenue is, again, assuming everything that's built is sold at this price, there's going to be the number of units times P, right? So, so it's S times P plus T times Q minus the cost, and of step one. Step two is what kind of optimization, what kind of method should we, should we use, and that's multi-variable, in this case, two-variable optimization. And I'll say it's unconstrained because we'll talk also about situations where you have to optimize, maximize, minimize a multi-variable function, having some constraints on the independent variable. So they're, they're still independent, but they have to satisfy certain constraints. All right, so, so what's step three? Standardize everything to, again, you don't have necessarily use X1, X2, but I don't know, maybe, maybe S, X1 is S, X2 is T, and Z is the profit, right? All right, let's call it Y. I don't know why I call it Z. Y is F of X1, X2 is a profit. And what's the profit? Well, is S. So it's X1 times whatever this P was, right? Plus X2, I'm just looking here, right? T times Q. Whatever Q is, but in terms of X1, X2 minus the cost, and it even becomes painful to write it down, right? So maybe just do this, 339 minus 0.01 X1 minus 0.003 X2 and so forth, right? What's the nice thing about having this computer handy is you can, you don't even have to write on a piece of paper, but just type it in here and make sure it's right. Okay, and notice that because we're still working with symbolic variables, I have to define X1, X2 first. And the very next thing that comes to mind is to plot it. So we plot this. Notice that it's no longer called easy plot, but it's called easy serve because it's going to give you a surface. If you don't specify the domain, it will pick it for you, and it might not be what you need. I think it's negative 2 pi to 2 pi on each variable, right? So first thing is you don't need negative X1, X2, right? But also the other thing is you might not know ahead of time. So let me just say Sims X1, X2. Oh no, it's doing again. I cannot type again. Wow, okay. You said it's two months before the tablets come out. Okay, I'm going to do it slowly. All right, but now Sims, okay. Sims, yeah, so notice that if I put a comma, it doesn't like it, right? So I can define, but there are various ways to define symbolic variables, but this is one way, and now I've defined Y, right? And now if I do easy plot, as I said, with no prior knowledge, well, no, what am I saying? Easy serve, right? Right? So that's, unfortunately, that's not the best because negative 2 pi to 2 pi, you saw that? So let's do 0 to 10, 0 to 10, doesn't look much different. So what's the problem? So since we don't know how large the X1 and X2 should be, what do we have to do first? We better solve. We better find if there is anywhere critical point, right? So again, the first time you develop this code, it doesn't just come out like that, right? You don't know 10,000 is what was going to capture the essential thing, but so the best thing is, well, if you have symbolic capabilities and we do, we can differentiate, take the derivatives, that's the gradient, right? Each partial derivative, and then we can solve it. We can solve this. So let's run this. So I've taken the derivative, but I didn't display it. If I have to display it, then, well, it's in there, right? But I didn't display it. Okay? So you see, I mean, the function was quadratic in X1 and X2. So the derivatives will be linear, right? Which makes it, okay, you're going to be able even to do it by hand, but even by hand, you have this equal to zero, and you have the other equal to zero, no reason to even attempt, because remember, next thing is going to, we're going to change some of those numbers, right? So notice how you solve a system. So you solve a system by actually putting, remember before, we just said solve in one equation, right? And we don't say the equation, we just say it was f, right? Or fx or something. And that assumes equal to zero, right? So now, now we actually, if we type this and then comma this, then it's going to be this equal to zero and this equal to zero simultaneously. Now if I only do this, guess what's going to show? It's going to give an answer, right? First of all, it's going to be in symbolic form, symbolic meaning just to convince yourself, remember, you can see the workspace, that's a good thing to watch, keep an eye on, right? And you can play around with this until it's the setup you want. So did I show you this workspace before? Yes? So you see the latest one, we computed where there's still a symbolic, right? So even though there are numbers, well first of all, you don't know how big the ones of those numbers are, so that's an incentive to actually convert them to double, right? So that's the reason why I'm actually running this. By the way, I just learned if you do control, enter on a cell, it also evaluates that cell and moves to the next one. But I'm not going to attempt it on this, so I'm just going to keep going here. Okay, so I've run it here and you see I didn't display, but you can see it here, right? So it's 4.73, 10 to the third, so this is like 4,000 something and 7,000 something, right? So at this point you can, if you want to display, that's why you go back and you choose a 10,000 by 10,000, because that's going to capture at least that critical point. Okay, so now I can see it and I can rotate it here, right? So everybody can see the maximum. You can do a bird's eye view, by the way, this is done by view 2. It just sets it from the top and you can do contour plots and other things, okay? One thing to keep in mind is that you never really get a perfect thing with symbolic, but easy serve C, no, let me see, easy contour and I think I spelled it right, thank you, 0 to 10,000, 0 to 10,000. By the way, if you put a comma here, you're going to get error, so it's a little bit sensitive to what, okay? So that's one thing, another thing is easy contour, if, there are various ways to do plotting and we're going to use some, but, okay? Anyway, so 4,000 and 7,000 is the critical point and you know what? What's missing in this code here? The secondary test. Didn't bother to do that because the graph showed it's a maximum, but right? I mean, you should never trust graphs. So I think subsequent codes have that, even that second derivative, right? Should we go through that second derivative test? So all you have to do here is say F11, let's say the derivative of, was it Y, with respect to X1 and then with respect to X1 again and I'm not going to, I'm not going to, I'm not going to display it, right? So the second derivative with respect to X1 with X2 is F22, F22 and F12 is, or F21 is this, right? So all the, all then you have to do is you have to take the, construct this Hessian. Yeah, but since it's the same as F12, my matrix is going to be just F11, F12, F21, F22. So in MATLAB, if you define a matrix, okay, two by two matrix, you see the semicolon actually starts a new row. And a space between just keeps, keeps you in the same row. So actually we can display this. Ah, thank you. But I can put F12, like, okay. And I get that matrix and I deny it just completely determinant, right? It looks positive, right? So it's either a local, max or local minimum. And what decides is the sign of the FXX, by the way, is the same as the sign of FYY. Why? Is it always going to be like that? Why, why do we always look on the FXX, sign of FXX and not, not FYY? Right, but take a look at this. FXX, FYY minus FXY squared, that's the determinant, right? If the determinant is positive, so just a note here. If the determinant is positive, it means that FXX or F11, F22 minus F12 squared is positive. So this is negative, so this F11, F22 cannot be negative, right? This means F11 and F22 have to have the same signs. Because if this were negative, you'd have two negatives, it couldn't be positive, right? So F11 and F22 have to have the same sign. If the determinant is positive, okay? So that's why there's no ambiguity when you check that. All right, so that's, all right, so now we're convinced it's a local max. Okay. How do we know it's an absolute max? We have to check on the boundaries, right? We really have to check on the boundary for, you know, you could have a single local max, right? But if you have an unbounded region, you have somewhere else settled and then things picking up again, right? So somehow you have to see what happens is X1, X2 go to infinity, and how do we see that? Well, take a look at the, well, the function F, or Y, whatever Y is, right? You look at the coefficients of X1 squared, X2 squared, those are the leading coefficients, and they're all negative. So it means as X1, X2 goes to infinity, things go negative, eventually even go negative, right? So it means you cannot beat, you cannot go higher than that value, which was, well, we didn't compute it. Here's the next, here's the computation of that value, but it's going to be a positive profit. Then also you have to check the boundary, like when X1 is zero, or X2 is zero, right? So our domain is, is what? Is the first quadrant. And then at the end, you can say, well, it's a maximum. But you know how it goes. I mean, you can actually claim, oh, I've done that in my head, and I've checked it, and it's okay, right? And I'll accept it unless your conclusion is wrong, okay? So, right? So, I mean, and eventually we will talk about problems where you don't even have an explicit solution, right? So then you actually can have, I can say nothing. It can say, well, it looks from the graph. Can you imagine that? I mean, in Calc 1, if you say from the graph we have a maximum, it's, it's by far, right? You have to do second derivative tests, right? But here we won't have explicit solutions, explicit functions very soon. So we can just say, well, on, on this region, we have a, you know, a maximum point or something just with no proof. Okay, so finally let me just run this a little bit more. I haven't even displayed Y max, but we can see what Y max is. Just convince yourself it's like 5.5 times 10 to the fifth. So that's certainly positive and quite big. All right. Any questions so far on this? So it's not much different except I wanted to be able to work with the code to adjust it to two-dimensional and three-dimension and so forth, right? Because you have to be able to adjust it, you know, to deal with those kind of problems. Now the last thing is I want to talk a few minutes about sensitivity. Okay. So sensitivity right now, I think the example talks about sensitivity to, to one of those numbers, 0.01, which was, is called, in this case, price elasticity. So again, it's the rate of change of the price when certain things happen in the market. So in this case, the more you sell, the cheaper it should be or the, maybe it's the other way around, but, right? It can be cheaper the more you sell, right? And still make more money, right? So the question is how should you, you know, how sensitive it is to this parameter, the price elasticity? So think about what it goes in. Well, it's kind of easy because once you have that typed in on the top, you just copy and paste. You don't type it again because you'll, you'll make errors and those will cost you a lot. So you just copy and paste and you replace that whatever value was with A. So let's follow this quickly here. So you differentiate with respect to x1, x2 at this point, and then you solve it. At this point, what you're going to get is a critical point, what is no longer going to be a number, I mean two numbers, right? A point in that plane, but it will be symbolic and it will be depending on A. So, yeah, so I actually display that here. Does it make sense? So again, the best way to imagine this, and I know this is kind of hard if you haven't seen it before, but is you have your objective function that has a maximum, right? For a fixed value of A. As you change that value of A, that preserves its shape, it preserves its property of having a single maximum, but it's just moving. It's moving, the maximum point, it moves and the maximum value may move, right? And those are the hats, little hats that I put here. You cannot put hats. So I just said, I just append an A next to it, but clearly depends on A. This depends on A. So now these are the two coordinates of that point. And next thing here is this cell, which is going to plot those. Now, you don't have to plot these things, right? Unless you're really interested in knowing how that production is going to change with that parameter. So you see the center is 0.01, and here it's 10% relative change, right? 20%, 30%, 40%, 50% change, relative change, right? And you see how, so if I'm looking at the second one, because it's closer to my hand here, but this was, what was this? X2 was the number of 21 units. So you see if that value actually is not 1 cent, the price of this is not 1 cent drop, but maybe 2 cents drop, then it's optimal if you increase that production and sales of the 21 inch and decrease the 19 inch, right? Believe me, you wouldn't be able to actually guess this by just reading that problem. I mean, you have to be supernatural, too. Or really, I mean, leave each sleep, breathe economics to figure this out, all right? And you can do, excuse me, you can do sensitivity the same way as we did. And you're going to get the sensitivity of the X1 with spectra A is going to be negative, right? And sensitivity of X2 with spectra A is going to be positive. So the first one is negative, second one is positive. I called S both, it's not a good practice, but, right? And what if I have to now really figure out the sensitivity of the profit? Then I'd have to add, which I didn't add in the code, but Y max A, right? Is subs in Y, X1, X2. So this is kind of a new, if you haven't seen it before. You can substitute both variables, X1 and X2 with whatever X1 max A, X2 max A, and let's display it here. So I'm going to run this. Of course, it's never good to, well, to code it in the final script, in the file, especially if it's not at the bottom. If you try to introduce something that things may get messed up, but here was the bottom side. Okay, so this doesn't look pretty, right? You can, of course, you can easy plot. So I'm just going to do that command line. Easy plot Y max A, just to see, but it's not a good thing to do because this allows negative values for A, right? And it allows values that are maybe not relevant. What was A? It was 0.01, right? So you just 1.1 or something like that. In any case, you see it's a drop. So the higher the A, the smaller the optimal profit will be. So that's what I'm going to show you. Last word is next time we'll talk about constraint optimization. So I posted actually the code that goes with that with constraints. I don't want you to look at this necessarily, but I wanted to look at the handout on Lagrange multipliers. There's a Calc 3 thing. We'll discuss it briefly on Monday, but I wanted to look at this. It's really, it's handwritten, so it's just kind of my short version of Lagrange multipliers or take any Calc 3 book that talks about Lagrange multipliers and just remember what they are, okay? All right? Any questions? Shoot me an email. Don't forget my office 271. Thank you. Everybody signed this piece of paper?