Lab 3: Computer-assisted problem solving

Introduction

The goal of this lab is to solve two applied exercises using your previous knowledge of Mathematica from the first two labs. The first exercise is to optimize your seating location at the theater so that the screen fills the largest possible angle of your vision, and the second is to dedue and prove a general partial fracions formula. Two commands that you will find useful for the first exercise are Table and ListPlot. The second exercise should be solvable using commands you have previously seen in Labs 1 and 2.

Using Table and ListPlot

Mathematica's Table command is can produce a list of data based on a generating rule. The general form is:
Table[expression, iteration rule]

For example, the following generates a list of the first 9 perfect squares:

Table[i^2,{i,1,9}]

The expression (i^2) contains the variable i which is used as the iterator. The {i,1,9} portion of the command causes i to take on all integer values starting from 1 and going to 9, in increasing order. You can also step down in decreasing order:

Table[i^2,{i,9,1,-1}]

Or step up, or step down, by 2’s 3’s, etc.

Table[i^2,{i,1,9,2}]

Table[i^2,{i,9,1,-2}]

Now let’s say we only want perfect squares for i ranging from 3 to 9, and we want to record i as well as its square. This is done by:

Table[{i,i^2},{i,3,9}]

As another example, let’s say we want to sample the function f(x)=sin(x) from 0 to π, with the distance between samples being π/8. We want to record the x and f(x) values together in a list.

SineSampleCoords=Table[{x,Sin[x]},{x,0,Pi,Pi/8}]

Now we can use the ListPlot command to display these points:

SineSamplePlot=ListPlot[SineSampleCoords]

And finally, we can display the sample points on top of the original function by plotting sin(x) separately, and then showing the two plots together.

SinePlot=Plot[Sin[x],{x,0,Pi}]

Show[{SineSamplePlot,SinePlot}]

Exercises

Assignment 1:  Where to sit at the movies

A movie theater has a screen that is positioned 10 feet off the floor and is 25 feet high. The first row of seats is placed 9 feet from the screen. The rows are set 3 feet apart. The floor of the seating area is inclined at an angle of α=(20^o) above the horizontal, and the distance up the incline that you sit is x. The theater has 21 rows of seats, so 0≤x≤60. Suppose you decide that the best place to sit is in the row where the angle θ subtended by the screen at your eyes is maximum. Let’s also suppose that your eyes are 4 feet above the floor, as shown in the figure.

First, develop a function of θ in terms of x such that x is allowed to take on the entire domain [0,60], not just the values 0,3,6,...,57,60 at which there are seats. Show that 
		θ=arccos((((a^2)+(b^2)-625)/(2a b)))
where
		(a^2)=(((9+x cos α))^2)+(((31-x sin α))^2)
and
		(b^2)=(((9+x cos α))^2)+(((x sin α-6))^2).
(Hint: First, you need (x,y)-coordinates of your eyes in a reasonable coordinate system.)

Use the Table and ListPlot commands to show the values of θ for the 21 possible rows in which you could sit. In which row should you sit, and what is the viewing angle θ in this row?

Find the derivative of θ in terms of x, and find a numerical value for the root of the equation dθ/dx=0 (for example, using the NSolve command). How does this value compare to what you determined in Part 2?

Compute and compare the following four quantities:
	(i) The average of the 21 angle values found in Part 2,
  	(ii) The average value of θ on the entire interval [0,60] (Hint: use NIntegrate)
	(iii) The miniumum value of  θ on the entire interval [0,60], and
	(iv) The maximum value of θ on the entire interval [0,60].

Assignment 2:  Patterns for integration

See page 529 of the text: