Vector-Valued Functions and Mathcad

advertisement

Vector-Valued Functions and Mathcad

D. P. Morstad, University of North Dakota

1.

2.

Objectives of Assignment

To learn how to make Mathcad graph two- and three-dimensional vectorvalued functions.

To learn how to make Mathcad display these graphs with useful axis

ranges and appropriate aspect ratios.

3. To examine a variety of vector–valued functions and their graphs.

I. Using Mathcad to Graph Two–Dimensional Vector–Valued Functions

Suppose you want to graph the curve defined by r r

( t ) = t 2 i r

+ ( t 3 − 4 t )

To do this with Mathcad , you need to do three things:

1. First, define the component functions: x ( t ) : = t 2 r j . y ( t ) : = t 3 − 4 t .

2. Second, BELOW the definitions Insert an X–Y Plot.

3. Third, type x ( t ) in the placeholder along the x -axis and y ( t ) in the placeholder along the yaxis.

Your graph will look like the left graph below, but you want it to look like the right one:

1000

0

1000

0 50 100

6

− 6

4

3

2

1

6

5

1

2

3

4

5

6

− 8 8

13

To get the better view of this vector-valued function, you will need to change the scale of both axes and alter some format options of the plot.

Mathcad plots graphs in a rectangle rather than a square. It is important to compensate for this so that circles will look like circles and ellipses will look like ellipses. This is called the aspect ratio. You will need to use an x : y aspect ratio of 4:3.

Click in the plot area and change the lower left and right numbers to –8 and 8 respectively. That will limit the x -axis from –8 to 8. Then change the top number along the y -axis to 6 and the bottom number to –6. That should make your vector-valued function look like the second graph up above. It is important to always change the scales of the axes so you will be able to see the interesting feature of your graph and to correct the aspect ratio. Only a fool would always accept a software package’s defaults.

You will also benefit from altering some format options. Double-click the plot area to open the X-Y Plot Formatting dialogue box. Make the following changes:

Click both Grid Lines

Deselect both Auto Grids and change to 16 and 12

Select Crossed

After making these changes, your plot should look like the second one above.

IMPORTANT: For this assignment, always use graphing windows that have an x:y aspect ratio of 4:3. That is, use − 4 ≤ x ≤ 4 and − 3 ≤ y ≤ 3 , or − 8 ≤ x ≤ 8 and

− 6 ≤ y ≤ 6 , etc. This proportion will guarantee that squares will look like squares instead of like arbitrary rectangles, and that circles will look like circles instead of ellipses.

II. Animation, Circles, Ellipses, and Variations

Graph r

( ) ti r

4 sin( ) r

by defining the component functions and then correcting the aspect ratio. Also change the format options to those used above. You should see a typical sine curve with amplitude 4.

14

is r r

( t )

Next, change your the defintion of the i component so your vector valued function

= 4 cos( t ) i r

+ 4 sin( t ) j . The graph of the sine wave should change to a circle of radius 4.

Now to animate the circle. First we will make the t go from 0 to 2 π in 100 steps.

Change the i and j component functions to: x ( t ) : = 4 cos( 2 π

100 t )

The 2 π

100

That is, y ( t ) : = 4 sin( 2 π

100 t )

(review the first computer lab unit if you don’t remember how to enter π or the fraction bar).

is in there so that if we make t go from 0 to 100, then 2 π

100 t will go from 0 to 2 π . when t = 0 → 100 , then 2 π

100 t = 0 → 2 π .

(NOTE: if you want to go from – π to π in 100 steps, you could use 2 π

100 t − π ; if you want to go from –3 π to π in 100 steps, you could use if you want to go from –3 to 6 in 100 steps, you could use

4 π

100

9

100 t − 3 π ; t − 3 . This is applying the “stretch and shift” technique to the argument of the component functions.)

Second we must make something go from 0 to 100. Let’s use a . This is accomplished in Mathcad using the FRAME variable. ABOVE the X-Y Plot, type: a : = 0, 1 ; FRAME (you must use all uppercase for FRAME).

Since we are using a , in the X-Y Plot change the x ( t ) to x ( a ) and y ( t ) to y ( a ).

Finally we can make it animate.

1) Click on VIEW and select ANIMATE to open the animate control box.

2) Change the settings so it goes From: 0 To: 100 At: 50 Frames/Sec.

3) Click and drag the mouse to draw a rectangle around the X-Y Plot.

4) Click on Animate in the animate control box.

This should animate the drawing of the circle. At it’s conclusion, a playback box with a slider appears on your screen. Move the slider to take notice of where the parametric curve starts, ends, and in which direction it goes (clockwise or counterclockwise).

15

Now for some variations. Change your component functions (you don’t have to type in new ones) to the following and animate the graphs to notice how the various changes alter the direction of the path and the starting and ending points.

Change to: x y

(

( t t

)

)

: =

: =

6

6 cos( sin(

2 π

100

2 π

100 t t

)

)

, then animate to see start, end, and direction.

Change to: x y

(

( t t )

)

: =

: =

6

4 sin( cos(

2 π

100

2 π

100 t t

)

)

, then animate to see start, end, and direction.

Change to: x y

(

( t t )

)

:

:

=

=

− 6 sin( 2 π

100

4 cos( 2 π

100 t t

)

)

, then animate to see start, end, and direction.

Try to find parametric equations that trace out the ellipse

Change to: x ( t y ( t

)

)

: =

: = 4 sinh( t )

. x 2

25

+ y

9

2

= 1 , starting and ending at (-5,0) going in the counterclockwise direction.

III. Hyperbolas and Lissajous Figures

To graph a hyperbola, simply switch to hyperbolic functions. Using the same definitions and X-Y Plot you were using for circles and ellipses, make the following changes.

4 cosh( t )

Notice that this only graphs the right half of the hyperbola. To see the left half, you need to change the i component to x ( t ) : = − 4 cosh( t ) .

Try switching the sinh and cosh around for the x ( t ) and y ( t ), and try coefficients other than 4 to see how changes in these values alter the curve.

Now for some Lissajous figures. These are based on sine and cosine, as the circles and ellipses are, but the frequencies of the sine and cosine are not equal. These will be viewed best with animation.

Change your definitions back to x y

(

( t t

)

)

: =

: =

6

4 sin( cos(

2 π

100

2 π

100 t t

)

)

. This will let you animate a simple ellipse. Now multiply the argument of the sine component by 3 by changing it to: x y

(

( t t

)

)

: =

: =

6

4 sin( cos(

3 ⋅

2 π

100

2 π

100 t ) t )

.

16

Change the X-Y Plot back to x ( a ) and y ( a ), and animate From: 0 To: 100 At: 50

Frames/Sec. It should be apparent what multiplying by 3 does.

Now also multiply the cosine argument by 5 by changing it to: x y

(

( t t

)

)

: =

: =

6

4 sin( cos(

3

5

2 π

100

2 π

100 t t

)

)

Animate this as well. Try multiplying by numbers other than 5 and 3 to see how they work in unison to create different types of Lissajous figures.

IV. Standard Curves and Paths

Standard functions of one variable such as f(x) = x 2 are easily represented by vector–valued functions. Simply use f ( x ) = x 2 , graph r ( t ) = t i + t 2 j x ( t ) = t and y ( t ) = f ( t ) . For example, for

. Change the X-Y Plot settings so the x -axis goes from

–2 to 2, and the y -axis goes from 0 to 3. Let a := –2, –1.9..FRAME. Animate this From:

–2 To: 2 At: 50 Frames/Sec.

To get y = x 2 you only need to make sure that the y component is the x component squared. For example, it still works if you let your graph will be part of x ( t ) = sin( t ), y ( t ) = sin( t ) 2 y = x 2 . Animate this and try to figure out why this only plots part of the parabola.

For f ( x ) = x 3 − 2 x 2 − 5 x + 6 , use x ( t ) = t , y ( t ) = t 3 − 2 t 2 − 5 t + 6 . This looks best with the x -axis going from –4 to 4 and the y -axis going from –10 to 10, but this is not a 4:3 aspect ratio, the graph is stretched out horizontally.

IV. Graphing Three–Dimensional Vector–Valued Functions with Mathcad

Three-dimensional vector-valued functions are a easy to graph with Mathcad , but unfortunately you can’t animate them. Just like with two-dimensional vector-valued functions, Mathcad will automatically choose which sections of the coordinate axes to show, but you can alter it by double-clicking the plot window and changing the settings.

Mathcad uses the 3D Scatter Plot for space curves, but by default it only plots a few points along the curve. You will have to change the settings to get a curve.

To graph r r

( t ) = t r i + t 2 r j + t 3 r k type:

17

x ( t ) : = t y ( t ) : = t 2 z ( t ) : = t 3

Then click your mouse somewhere BELOW these definitions. Go up to Insert , Graph and choose 3D Scatter Plot . This will insert a 3D Scatter Plot box on your screen. In the placeholder in the bottom left corner, type ( x , y , z ). You must put lists of component function names in parentheses. That should give you a plot of points in space. To better see their positions in space, click on the graph and drag. Pretty slick.

To improve on the default 3D settings, double-click on the graph, and make the following changes to appearances:

Select Appearance Tab

Deselect Draw Points

Select Lines

Select Colormap

To adjust the axes, while still in the 3D Plot Format box click the Axes tab and make the following changes to the x -axis, y -axis, and z -axis tabs:

Select Axes Tab

Deselect Auto Scale

Change to -10 and 10

Also make these changes under the y- and z-axis tabs

When you examine these three-dimensional graphs, remember that the axis as shown on the screen are not intersecting at the origin.

1.

Try graphing the following three-dimensional vector-valued functions.

Graph t i r

+ sin( ) r

+ r

. Use − 2 ≤ x , y ≤ 2 and − 10 ≤ z ≤ 10 .

This graph and many three dimensional parametric plots will benefit from changing the range of the parameter

10 ≤ t ≤ 10 t . By default, Mathcad uses − 5 ≤ t ≤ 5 . To change it to − double click the graph and make the following changes under the QuickPlot Data tab:

18

Select QuickPlot Data Tab

Change to -10 and 10

Change to 50

2.

3.

4.

Graph

Graph

Graph r

( ) ti r

= + t i t i r r

+

+ sin( ) t j r r

+

+

2 r

. Leave settings the same.

2 t k r t j r

+ t k r

. Use

. Leave settings the same.

− 10 ≤ x ≤ 10 and − 2 ≤ y , z ≤ 2 .

Vary the frequencies and amplitudes to see what else happens.

V. Some Fancier Two–Dimensional Curves

All of the following curves should be smooth except at a few specific points. You will be using a variety of values for r , b and c , so first define them with some initial values: r : = 0 .

5 , b : = 0 .

5 , c : = 0 .

5 . Then define your component functions BELOW these three variable definitions.

These graphs will need to be animated to adequately control Mathcad’s use of the parameter t . Use a : = 0 , 0 .

1 ..

FRAME . For many of these, you will want to go from 0 to

2 π . Since 2 π is just a little less than 7, use From: 0 To: 7 At 25 Frames/Sec in the

Animate control box. For the first two, use –2 π to 2 π . You might need to increase the range of the parameter from 2 π to 4 π or 8 π on 3), 4), and 5) below.

1. Cycloids . Suppose you are driving along some warm summer night and a bicycle rider crosses your path about a block ahead of you. If he has a reflector in his spokes, you will notice a very distinctive path that the reflector is taking. The closer the reflector is to the tire, the more distinctive the path and movement will be. If you have ever seen this, the reflector seems to kind of hop along rather frenetically. If the reflector is mounted right on the side of the tire, the path it will follow is called a cycloid .

The vector–valued function which describes a cycloid is:

( t ) = r ⋅ ( t − sin( t )) r i + r ⋅ ( 1 − cos( t )) r j where r is the radius of the tire. Use 0 ≤ x ≤ 10 , − 2 ≤ y ≤ 2 and set the options in X-Y

Plot so Auto Grid is not selected and set the number of grids to 7 for x and 4 for y . Graph a few of these using r = 0.5, 0.75, and 1. When typing these definitions, be sure to

19

include the multiplication symbol between the r and the parenthesis, otherwise Mathcad will think r is suppose to be a function. While using the slider, notice that movement along the path of the curve is faster at the tops than at the cusps at the bottom.

2. Trochoids . If the reflector happens to be somewhere between the tire and the axle, the path it will follow is called a trochoid . It is somewhat different from a cycloid.

The vector-valued function for a trochoid is:

( t ) = r ( t − b sin( t )) r i + r ( 1 − b cos( t )) r j where r is the radius of the tire and b is the distance from the reflector to the axle. Try a few of these using the same values as in #1 along with some values of b which are between 0 and r .

3. Epicycloids . If the bicycle wheel happened to be rolling around the outside of a large circle, then the path of the reflector is called an epicycloid . The vector-valued function is:

( t ) =

(

( r + b ) cos( t ) − b cos

( ) ) r i +

(

( r + b ) sin( t ) − b sin

( ) ) j r where r is now the radius of the large circle, and b is the radius of the wheel. When r = b , the resulting epicycloid is called a cardiod .

Change the axis to a true aspect ratio using − 8 ≤ x ≤ 8 , − 6 ≤ y ≤ 6 . Grid lines will be helpful here, too (16 and 12). Try r = 2, b = 2; r = 2, b = 1; r = 1.5, b = .5; r = 1, b = 2. Try a few other values of r and b . You might have to increase how large the parameter becomes by increasing the “To:” value in the Animate box.

4. Hypocycloids . If the wheel is rolling around inside a larger circle, the path of the reflector is called a hypocycloid . The vector-valued function for a hypocycloid is:

( t ) =

(

( r − b ) cos( t ) + b cos

( ) ) i r

+

(

( r − b ) sin( t ) − b sin

( ) ) r j where r is the radius of the larger circle and b is the radius of the wheel. You don’t need to type these in, just modify the equations you used for the last problem. Graph a few of these using r = 4, b = 1; r = 3, b = 1; r = 2, b = 1; r = 5, b = 3.

5. Spirograph patterns. The Spirograph toy is just a simple mechanical device which allows you to trace epicycloids and hypocycloids where the pencil (or the reflector, if you want to use the bicycle analogy) is not right on the edge of the wheel, but is somewhere between the edge of the wheel and its center. These curves can be represented by vector-valued functions as well. These are just slight modifications of the hypocycloid function – simply multiply the denominators by a factor c :

( t ) =

(

( r − b ) cos( t ) + b cos

( ) ) r i +

(

( r − b ) sin( t ) − b sin

( ) ) j r

20

You don’t need to type these in, just modify the equations you typed in for #4. Try some of these using the same numbers as in the last problem, but then use 0.5, 0.4, 1, 2, and 3 for c .

21

Download