Next: Appendix

CPS 202 HW 5 Solution

The purpose of this assignment is to determine the maximum area of a rectangle of fixed perimeter. This will be done by first performing a simple analysis to arrive at a one-dimensional formula for the area. A short FORTRAN 90 program is then written to create a set of discrete points. Finally, the points are plotted in MATLAB, whose graphical zoom capabilities are used to determine the maximum area.

Given the rectangle shown in Figure 1, the area is given by

 (1)

The perimeter is fixed to be 57.68:

 (2)

Solving the perimeter equation for L and substituting into Equation 1 gives

 (3)

From the geometry of the rectangle, it is clear that this problem only makes sense for

The exact solution of to this problem can be found by taking the first and second derivatives of Equation 3. This gives

 (4) (5)

The first derivative is zero when

Because the second derivative is always negative, the second derivative test concludes that this is the only local maximum. Also, the area at the endpoints of the domain is zero, hence this value of is also the global maximum. The corresponding value of is

and the maximum area is

The results indicate that the maximum area that can be enclosed is when the rectangle is actually a square.

The FORTRAN 90 program to create a set of discrete points for is attached. The program requests a number of discrete points, on the interval It then computes the points and writes these to a file. This data in this file is then plotted by the MATLAB function pfun (also attached).

Some experimentation was necessary in order to obtain a graph that was sufficiently smooth in order to obtain reasonable accuracy. Figure 2 shows the function using points. In order to obtain a good estimate of the maximum area, the zoom capabilities of MATLAB were used to zoom in on the apex of the parabola in Figure 2. The final zoom is shown in Figure 3. From this graph, the estimates can be obtained. These results agree very well with the exact values. It is interesting to note that for good accuracy, it is essential to choose an odd number of discrete points. If an even number is chosen, the zooming process will result in a graph shown in Figure 4 (using N = 20 points). This graph clearly shows that an accurate of estimate of is difficult if not impossible for even values of In this example, the value of is accurate to at most the second significant digit. Though not shown, further experiments reveal that for even values of this effect is still present to some degree no matter how many discrete points are used.

Next: Appendix
Leigh J. Little 2004-02-10