Assignment #8



In this assignment we are going to solve equations and then try to visualize our solutions. You might have encountered the solve command in a few of the assignments before (you could have avoided using it, if you wanted too). Now I want to put it together with a little bit of application of mathematics. You might want to look at the help page for the command solve and subs because these might be commands I think that you need to use (although as always you might be able to find other means of answering the question and in this case you can probably solve the problem by hand).

Question #1:
I am really not in favor of 'story' problems which motivate some mathematics unless they really do come from some real life example because they tend to start to look artificial after a while. Here is a perfect example of such a story problem:

A firm uses $x$ units which costs $\$4$ per unit of chemical 1, and $y$ units of chemical 2 which costs $\$3$ per unit in making their product. Therefore their total costs is $4x+3y$. Say that it also takes twice as much of chemical 2 as chemical 1 so that we are restricted to $2x=y$. Moreover, with the input of $x$ and $y$ units of chemicals they can produce $x^{1/3} y^{1/2}$ units of the and the product is worth $\$10$. The total profit is $p(x,y) =$ revenue - costs $= 10 x^{1/3} y^{1/2} - (4x+3y)$.
Step 1: Maximize the profit equation subject to the constraint $2x = y$. That is, determine $x$ and $y$ which maximizes the function $p(x,y)$ subject to the constraint $2x=y$. I would like you to find this maximum by taking the derivative of $p(x,2x)$ and setting it to $0$ and finding any maxima and minima of the function. Convince yourself that this is in fact a maxima by plugging in other nearby values.
Step 2: Now graph the profit equation $z = p(x,y)$ as a surface in an appropriate range around this maximum point using plot3d.
Step 3: Plot the point $(x, y, p(x,y))$ in three dimensions (you might want to use the command pointplot3d but if you search through the commands of with(plots); I am sure you will find other ways of plotting a single point in 3d.
Step 4: Graph the curve in three space consisting of points satisfying $2x=y$ and $z = p(x,y)$. You might want to use the function spacecurve of the $(t, 2t, p(t,2t))$ for values of $t$ around the same range for which you found the maximum values of $x$ and $y$.
Step 5: Display the surface, point and curve on the same graph as the plot3d that you produced. Explain in words what you observe. Do you see that the point is in fact maximal subject to this constraint? Why or why not?

Question #2 I would like you to solve the exact same problem using Lagrange multipliers. This is a method for also finding maxima and minima of functions satisfying certain conditions. This particular question is a toy example (and completely artificial at that) because you can easily solve this problem without using Lagrange multipliers, but hopefully it will demonstrate how the problem works so that we can do more interesting examples afterwards.

Step 1: You are to find the solution to the system of equations. \[ 2x - y = 0 \] \[ \frac{\partial}{\partial x} (p(x,y) - \lambda (2x-y)) =0 \] \[ \frac{\partial}{\partial y} (p(x,y) - \lambda (2x-y)) =0 \] for the three unknowns $x, y, \lambda$. This should give you the same $x$ and $y$ values as in the previous problem, but I want you to set up the system of equations and solve them as a Lagrange multiplier problem.
Step 2: Next I would like you to give a contour plot of the function $z = p(x,y)$ in the region around the maximum that you found.
Step 3: On the same graph, plot the line $y = 2x$ and the point $(x,y)$ where you found the maximum (this is a two dimensional representation of the graph that you produced in the previous problem).





You should open up a new worksheet and start from scratch. You will have to save your work in a file and upload that file on to the course moodle. Your solution should be a sequence of commands where it is easy to change the input string and after you execute the sequence of commands you should have the correct output string. Please add documentation to your worksheet to explain how it works. Just a few sentences is sufficient, but imagine that you were opening up the worksheet for the first time and wanted to know what it did. You will be marked down if what you write is not clear and coherent.

You should finish your assignment by Wednesday, October 31 by 11:59pm. Assignments submitted after this date will be assessed a penalty of 10% per day.