>   

lab15.mws --- Plotting in Polar Coordinates

>    restart;
with( plots ):

Warning, the name changecoords has been redefined

>   

Auxiliary Commands -- Execute but Do Not Change

>    P_to_C := P -> [P[1]*cos(P[2]),P[1]*sin(P[2])]:

>    C_to_P := C -> [simplify(sqrt(C[1]^2+C[2]^2)),arctan(C[2],C[1])]:

>   

Lab Overview

We have explored quite a few topics this semester. I hope you have found these labs interesting, useful, and enjoyable. I hope that some of the information you have learned will be useful in future courses. If you use the techniques introduced in these labs you can do a lot of neat things. If you have questions, please feel free to contact me with your questions. My e-mail is meade@math.sc.edu.

The final topic in this course is polar coordinates. In this lab you will SEE these objects and have the opportunity to become more familiar with the graphical aspect of these topics.

Ending the practice from recent weeks, this lab assignment does not include a separate and explicit integration problem. In fact, this week there is no assignment at all.

  Deadline for submitting a lab solution is midnight, yesterday.  

>   

Plots of Points in Polar Coordinates

Consider the first assigned problem from Section 12.6: Plot the points whose polar coordinates are

>    PTS_polar1 := [ [3,2*Pi], [1,Pi/2], [4,Pi/3], [0,Pi], [1,4*Pi], [3,11*Pi/7], [5/3,Pi/2], [4,0] ];

PTS_polar1 := [[3, 2*Pi], [1, 1/2*Pi], [4, 1/3*Pi], [0, Pi], [1, 4*Pi], [3, 11/7*Pi], [5/3, 1/2*Pi], [4, 0]]

>    polarplot( PTS_polar1, style=point );

[Maple Plot]

>   

Now, complete the next assigned problem by entering the data points for #3 (p. 544).

>    PTS_polar3 := [ %? ];

>    polarplot( PTS_polar3, style=point );

>   

The next assigned problem (# 7) asks for the Cartesian coordinates for some points given in polar coordinates.  The P_to_C  command defined at the top of this worksheet converts a point in polar coordinates to Cartesian coordinates.  (The C_to_P  command does the reverse transformation.)  For example,

>    P_to_C( [1, Pi/4] );

[1/2*2^(1/2), 1/2*2^(1/2)]

>    C_to_P( [sqrt(2),sqrt(2)] );

[2, 1/4*Pi]

To convert all of the points from #1 to Cartesian coordinates:

>    PTS_cart1 := map( P_to_C, PTS_polar1 );

PTS_cart1 := [[3, 0], [0, 1], [2, 2*3^(1/2)], [0, 0], [1, 0], [3*cos(3/7*Pi), -3*sin(3/7*Pi)], [0, 5/3], [4, 0]]

>    P1 := polarplot( PTS_polar1, style=point,
                 symbol=circle, color=red, symbolsize=15 ):
P2 := plot( PTS_cart1, style=point,
            symbol=diamond, color=blue, symbolsize=20 ):
display( [P1,P2], axes=box );

[Maple Plot]

Likewise, converting these points back to polar coordinates with C_to_P  gives

>    PTS_polar1a := map( C_to_P, PTS_cart1 );

PTS_polar1a := [[3, 0], [1, 1/2*Pi], [4, 1/3*Pi], [0, 0], [1, 0], [3, -3/7*Pi], [5/3, 1/2*Pi], [4, 0]]

Compare these points with the original points in polar coordinates.

>    PTS_polar1;

[[3, 2*Pi], [1, 1/2*Pi], [4, 1/3*Pi], [0, Pi], [1, 4*Pi], [3, 11/7*Pi], [5/3, 1/2*Pi], [4, 0]]

Note that some of the points appear different -- but represent the same point.  In particular, the radius is never negative and all angles are in the interval [ 0, 2*Pi  ).

>    P3 := polarplot( PTS_polar1a, style=point,
                 symbol=cross, color=green ):
display( [P1,P2,P3], axes=box );

[Maple Plot]

>   

To check your work for #9, enter the Cartesian coordinates for each point in the list below then execute the next command to see the polar coordinates for each point.

>    PTS_cart9 := [ %? ];

>    PTS_polar9 := map( C_to_P, PTS_cart9 );

Complete the first argument of each of the following plot commands, then the display  command should confirm the two sets of coordinates represent the same points.

>    P4 := plot( %?, style=point,
            symbol=circle, symbolsize=15, color=blue ):
P5 := polarplot( %?, style=point,
                 symbol=diamond, color=blue ):
display( [P4,P5], axes=box );

>   

Plotting Polar Curves

It is easy to plot a polar curve, say for #25 (p. 544):

>    R25 := 3/sin(theta);

R25 := 3/sin(theta)

on a domain

>    DOMAIN := theta=0..2*Pi;

DOMAIN := theta = 0 .. 2*Pi

In fact, this can be done either directly in polar coordinates or by converting the equation to Cartesian coordinates.

>   

Polar Coordinates

The Maple command to create this plot directly in polar coordinates is very simple.

>    polarplot( R25, DOMAIN );

[Maple Plot]

Can you explain why this plot is correct? (Why is the graph horizontal? Why is the horizontal axis the way it is?)

>   

Cartesian Coordinates

Recall the formulae for converting polar coordinates ( r , theta  ) into Cartesian coordinates ( x , y  ):

>    X25 := R25*cos(theta);
Y25 := R25*sin(theta);

X25 := 3/sin(theta)*cos(theta)

Y25 := 3

>    plot( [ X25, Y25, DOMAIN ] );

[Maple Plot]

>   

>   

Now, using either of the methods described above, create a graph of the polar curve in #27 and #28.

>    R27 := %?;

>    X27 := R27* %? ;
Y27 := R27* %? ;

>    polarplot( R27, DOMAIN );

>    plot( [ X27, Y27, DOMAIN ] );

>   

>    R28 := %?;

>    X28 := R28* %? ;
Y28 := R28* %? ;

>    polarplot( R28, DOMAIN );

>    plot( [ X28, Y28, DOMAIN ] );

>   

The problems in Section 12.7 can almost all be handled in the same way.  Note that it is necessary to enter the equation in the form   r = F(theta) .  For example, for #17:

>    R17 := sqrt(4*cos(2*theta));

R17 := 2*cos(2*theta)^(1/2)

>    X17 := R17* %? ;
Y17 := R17* %? ;

>    polarplot( R17, DOMAIN );

[Maple Plot]

>    plot( [ X17, Y17, DOMAIN ] );

>   

Note that in some of the latter problems it will be necessary to replace DOMAIN  with a different interval of theta  values.

>   

For the spirals, modifying DOMAIN  is one way in which you can determine the direction of motion for an object following the spiral.  Another way is to use the animatecurve  command (with coords=polar ):

>    R31 := 2/theta;

R31 := 2/theta

>    animatecurve( [R31,theta, theta=0.1..20], coords=polar, numpoints=200 );

[Maple Plot]

>   

The plots for #45 and #55 in Section 12.7 (p. 549) are contained in a separate Maple worksheet.

>   

Intersection of Polar Curves

For a problem like #33, the two curves can be entered as

>    C1 := r=3*sqrt(3)*cos(theta);
C2 := r=3*sin(theta);

C1 := r = 3*3^(1/2)*cos(theta)

C2 := r = 3*sin(theta)

Prior to finding the intersections of these two curves (circles), it is useful to plot them to see the number and approximate location of intersections.

>    polarplot( [rhs(C1),rhs(C2)], theta=0..Pi, color=[red,blue] );

[Maple Plot]

There are two intersections.  One is at the orgin, the second is near ( 1.32, 2.25 ).  When Maple finds simultaneous solutions to the two equations, it finds:

>    solve( {C1,C2}, {r,theta} );

{r = 3/2*3^(1/2), theta = 1/3*Pi}

The Cartesian coordinates of the point with polar coordinates

>    SOL_polar := [ 3*sqrt(3)/2, Pi/3 ];

SOL_polar := [3/2*3^(1/2), 1/3*Pi]

is

>    SOL_cart := P_to_C(SOL_polar);

SOL_cart := [3/4*3^(1/2), 9/4]

Note that the floating-point approximation to this point is

>    evalf(SOL_cart);

[1.299038106, 2.250000000]

which agrees with the estimate made from the plot.  But, note that Maple did not report the solution at the origin.  Because we already had this point from the graph, this is not a concern.

>   

Area of Regions Defined by Polar Curves

To compute the area inside the curve plotted in #21 (Section 12.7), define

>    R21 := 5*cos(3*theta);

R21 := 5*cos(3*theta)

A graph of the curve can be found with

>    polarplot( R21, theta=0..2*Pi );

[Maple Plot]

To find the area of one leaf of this rose it is necessary to know the angles, theta , that define one leaf of the three leaves.  For this an animation is useful:

>    animatecurve( [R21,theta, theta=0..2*Pi], numpoints=100, coords=polar );

[Maple Plot]

Notice that when theta = 0  the curve begins at the point (5,0) and makes two complete traversals of the curve with 0 <= theta  <= 2*Pi .  The first lap around the curve ends when theta = Pi .  Actually, any interval of length Pi represents one lap of this curve.  Leaves begin and end at points on the curve with r = 0 .  That is

   5*cos(3*theta) = 0   

   cos(3*theta) = 0   

                                  3*theta = (2*n+1)*Pi/2   where n  is an integer

                                                                                           (i.e., 3*theta  is an odd integer multiple of Pi/2 )

   theta = (2*n+1)*Pi/6   

                                                      theta  = ..., -5*Pi/6, -3*Pi/6, -Pi/6, Pi/6, 3*Pi/6, 5*Pi/6, 7*Pi/6 , ...  

The leaf along the x -axis is obtained when -Pi/6  <= theta  <= Pi/6 .  The following graph confirms this

>    polarplot( R21, theta=-Pi/6..Pi/6, scaling=constrained );

[Maple Plot]

The area of this leaf can be found with the integral

>    AREA21 := 1/2 * Int( R21^2, theta=-Pi/6..Pi/6 );

AREA21 := 1/2*Int(25*cos(3*theta)^2,theta = -1/6*Pi .. 1/6*Pi)

>    value( AREA21 );

25/12*Pi

>    evalf( AREA21 );

6.544984695

Does this number seem reasonable? (Explain -- to yourself.)

>   

For another example, recall the plot of the two circles in #33.

>    C1;
C2;

r = 3*3^(1/2)*cos(theta)

r = 3*sin(theta)

>    polarplot( [rhs(C1),rhs(C2)], theta=0..Pi, color=[red,blue] );

[Maple Plot]

To find the area outside the red circle and inside the blue circle, note that this region can be divided into two regions.  The portion in the second quadrant is simply a semicircle with radius r = 3/2 .  The area of this region is known from geometry to be Pi*r^2/2  = Pi*(3/2)^2/2  = 9*Pi/8 .  This should agree with the value of the integral for the area in polar coordinates:

>    A1 := 1/2 * Int( rhs(C2)^2, theta=Pi/2..Pi );

A1 := 1/2*Int(9*sin(theta)^2,theta = 1/2*Pi .. Pi)

>    value( A1 );

9/8*Pi

>    evalf( A1 );

3.534291736

The portion in the first quadrant begins at the (non-zero) point of intersection ( theta = Pi/3 , found earlier) and continues for all angles up to theta = Pi/2 .  For each angle in Pi/3  <= theta  <= Pi/2 , the outer radius is the blue circle and the inner radius is the red circle.  Thus, the portion of the area of the region inside the blue circle and outside the red circle in the first quadrant is given by

>    A2 := 1/2 * Int( rhs(C2)^2-rhs(C1)^2, theta=Pi/3..Pi/2 );

A2 := 1/2*Int(9*sin(theta)^2-27*cos(theta)^2,theta = 1/3*Pi .. 1/2*Pi)

This integral can be evaluated after using some trigonometric identities. (Use the Integration  maplet [ Maplet Viewer][ MapleNet] to help with the details.)  The exact value for the area is

>    value( A2 );

-3/4*Pi+9/4*3^(1/2)

>   

>    evalf( A2 );

1.540919827

The total area inside the blue circle and outside the red circle is the sum of the areas in the first and second quadrants.

>    AREA33 := A1 + A2;

AREA33 := 1/2*Int(9*sin(theta)^2,theta = 1/2*Pi .. Pi)+1/2*Int(9*sin(theta)^2-27*cos(theta)^2,theta = 1/3*Pi .. 1/2*Pi)

>    value( AREA33 );

3/8*Pi+9/4*3^(1/2)

>    evalf( AREA33 );

5.075211563

Observe that this area is smaller than the area of the blue circle ( (3/2)^2*Pi  = 9/4*Pi  = 7.07 ).

>   

The difficult part of this problem is setting up the limits of integration and the integrand.  The following animation should help to emphasize the choices in this problem.  The Maple code is complicated, but the result is worth it!

>    BKGRND := polarplot( [rhs(C1),rhs(C2)], theta=0..Pi, color=[red,blue] ):

>    ray1 := unapply( [[rhs(C1),theta],[rhs(C2),theta]], theta ):
ray2 := unapply( [[0,0],[rhs(C2),theta]], theta ):

>    frame1 := theta -> display( [polarplot( ray1(theta), color=cyan ),BKGRND] ):
frame2 := theta -> display( [polarplot( ray2(theta), color=cyan ),BKGRND] ):

>    angles1 := seq( Pi/3 + (Pi/2-Pi/3)*i/50, i=0..50 ):
angles2 := seq( Pi/2 + (Pi  -Pi/2)*i/50, i=1..50 ):

>    display( [seq(frame1(theta), theta=[angles1]),
          seq(frame2(theta), theta=[angles2])], insequence=true );

[Maple Plot]

>   

Lab Questions

I know, I promised no questions this week. This week's lab questions can come from you. Please ask any questions that you have about Maple, the labs, or mathematics in general. Any of us (Kevin, Jay, or Doug) will be happy to answer your questions to the best of our abilities. Of course, Kevin and Jay are likely to defer your questions to me. That's only fair and I won't hold it against them for too long.

>   

>