Assignment #9

In this assignment we are going to solve equations and then try to visualize our solutions. You will probably need to use the function fsolve in order to find the answer to this problem because I am not certain that Maple will be able to find exact solutions in this case. Moreover, it is likely that you will need to tell the function fsolve what the bounds of where the solutions are.

Question #1:
Say that you are in a pirate ship that is traveling along a curved river (which roughly follows the equation $y_1 = x_1 (sin(x_1) + 1)$) as you travel from the southwest and you head to the northeast (from $-\infty < x_1 < \infty$). The cannons out of the side of your ship can only fire perpendicular to the direction that the ship is pointing. Ahead, you see a castle tower (the outer walls of the castle are given by the parametric equation $(x_2,y_2) = (cos(t)-1,sin(t)+3)$ or the implicit equation $(y_2-3)^2 + (x_2+1)^2 = 1$). As you float down the river you know that you might only get a few chances to fire on the castle and you want to do that from the closest possible points. The object of this problem is to find those points where you should fire on the tower.

Step 1: Graph the path of the river and the outer walls of the tower. Choose your $x_1$ range for the river to be from $-2\pi$ to $2\pi$ and plot the whole tower.
Step 2: Determine the points as you pass along the river where you will get the best shot on the castle tower. Do this by minimizing the equation of the distance between a point on the river and a point on the castle tower subject to the constraint that the slope of the line between the points must be perpendicular to the river. Do this using the technique of Lagrange multipliers that we used in the last assignment. Make clear what function you are trying to minimize and what your constraint equation is.
Step 3: Determine the points along the curve following the river and the points on the castle tower that you will hit. Determine if your points are maxima or minima and pick out the ones that minimize the distance.
Step 4: Graph the points on the curve where the shot should be fired, the point of impact of cannon on the castle tower, and the lines connecting the pairs of points. You should find that there are three extrema near the castle tower (there are more if you look in a range from $-\infty$ to $\infty$), but not that all extrema are maximal.
Bonus: animate the point of the ship sailing down the river and firing on the castle.

Question #2:
Graph the surface of the distance between the points on the river and the points on the tower for $-2 \leq x_1 \leq 2$ and an appropriate range for $x_2$. Graph the surface of constraint equation in 3d as well. Display the graphs on the same three dimensional plot. Add in the points where your extrema were (both the maxima and the minima) and see if you can identify that they look like maxima and minima on these surfaces. Explain what you see on your graph.

Note: On this second problem, it does seem to be difficult to visualize the graph in the way that I would like. I would like you to graph the surface of the equation you are trying to maximize/minimize and the constraint on that surface. One way to do this will be to plot the surface as a contourplot. Next, plot the extrema points and display them on the same graph. Finally, plot the constraint equation as an implicitplot and also display it on the same graph. This constraint equation is very complicated so I suggest that you use the plot option grid=[1000,1000] so that your plot looks nice. The extrema points should appear on the graph of the constraint equation. Explain which ones are maxima and which are minima.

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, November 7 by 11:59pm. Assignments submitted after this date will be assessed a penalty of 10% per day.