Quiz #3 Polar Arc Length and Area--- Fall 2007

Contents

Hand calculated solutions.

Exercise #1 --- Close all open figure windows.

The following command will close all open figure windows. This is something we do so that running the file will popup a fresh new figure window and we won't have to use the mouse or the command shg to bring the figure window to the front of the desktop.

close all

The domain.

We use the linspace command to produce 200 equally spaced points on the domain [0, 2pi].

theta=linspace(0,2*pi,200);

Compute r

r=1-cos(theta);

Compute x and y.

We next compute x and y using the polar to Cartesian transformations. Note the use of the array operators (dot-notation).

x=r.*cos(theta);
y=r.*sin(theta);

The plot.

We plot the result in the xy-plane

plot(x,y)

Annotate the axes and provide a title.

We use the xlabel, ylabel, and title commands to annotate the axes.

xlabel('x-axis')
ylabel('y-axis')
title('r = 1 - cos \theta')

Smybolic Computation -- Arc Length

In this segment, we will use the Symbolic Toolbox, Matlab's interface to Maple to make some symbolic calculations to check our hand-written evaluation of the integral for arc length.

First define theta as a symbolic variable, then define r in terms of theta.

syms theta
r = 1 - cos(theta);

Define ds

Define the fundamental piece of arc length and simplify the result.

ds=sqrt(r^2+diff(r,theta)^2);
ds=simple(ds)
 
ds =
 
(2-2*cos(theta))^(1/2)
 
 

Integrate

We now use the int command to integate

L=int(ds, 0, 2*pi)
 
L =
 
8
 
 

Symbolic Computation --- Area

In this segment, we will use the Symbolic Toolbox, Matlab's interface to Maple to make some symbolic calculations to check our hand-written evaluation of the integral for area.

First define theta as a symbolic variable, then define r in terms of theta.

syms theta
r = 1 - cos(theta);

Define dA

Define the fundamental piece of area and simplify the result.

dA = 1/2*r^2;
ds=simple(ds)
 
ds =
 
(2-2*cos(theta))^(1/2)
 
 

Integrate

We now use the int command to integate

A=int(dA, 0, 2*pi)
 
A =
 
3/2*pi