MA 131 – Lab 1 – Name That Function

advertisement
MA233
Lab 7: Curly Vector Fields
version 11/14/06
Today we’ll use Matlab to help us visualize line integrals.
Your report will be due Thursday, 30 November. Make
sure to add a paragraph summary of your lab
experience…
1. In today’s lab, we’ll be using several m-files that define
commands that aren’t native in Matlab. In order to
seamlessly use these new commands, you’ll need to tell Matlab where to find
them.
a. Click on File->SetPath
b. Click on Add Folder
c. Browse to shares->Parker->ma 233 and click OK
d. You should now have this path at the top of the path list. Click Save at
the bottom of the page, and then close.
e. Now you should be ready to roll!
2. Just as we did on the project, we’ll be working with numerical functions, rather
than symbolic functions. This means that we’ll need to make our functions
“vector-smart”: So, rather than entering something like: 3*x^2-4*y/8,
you’ll need to do something more like:
3.*x.^2-4.*y./8
(so put periods before any multiply, divide, or exponentiation)
You’ll also need to tell Matlab what variables are in your function:
@(x,y) 3.*x.^2-4.*y./8 so use the @(x,y) in front of any functions today.
3. I think that is all the preliminaries we’ll need. Let’s start by looking at an easy
way to graph a vector field. We’ll use the field m-file, which uses the following
syntax: field(u(x,y), v(x,y) ,[lo-x hi-x lo-y hi-y])

where the vector field is given by F  u x, y iˆ  vx, y  ˆj , and we wish to graph
the field over the rectangle x-lo ≤ x ≤ x-hi and y-lo ≤ y ≤ y-hi.

a. Go ahead and graph the vector field F  sin  xyiˆ   x  y  ˆj over the
b.
c.
d.
e.
square [0 2.2 0 2.2]. Here’s the syntax:
field(@(x,y) sin(x.*y), @(x,y) x-y, [0 2.2 0 2.2])
Think about work integrals in this vector field. If we go from (0.5,0.5)
to (2, 2) in a straight line, do you expect positive, negative, or 0 work?
Include a graph of the vector field and annotate a path that would have
positive work moving from (0.5, 0.5) to (2, 2).
Annotate a path that would have negative work moving from (0.5, 0.5) to
(2, 2).
Is this vector field conservative? Explain.
4. We can use the lint m-file to calculate work, or line, integrals on line segments
in the vector field. This macro will graph a vector field, just like field does, and
then allows us to specify the number of line segments we
want to calculate our work integrals over. By clicking in
the figure window, you set the endpoints of each line
segment. Let’s see how to use lint:
lint(u(x,y), v(x,y) ,[lo-x hi-x lo-y hi-y])
Well… isn’t that special! It is the same syntax as field.
a. We’ll be looking at some work integrals in the

vector field F  sin  xyiˆ   x  y  ˆj from (3). Go
ahead and run the command. You might find it handy to maximize the
figure window.
b. Back in the command window, you’ll notice that your are prompted with
enter the number of segments in your path
go ahead and enter 1
Back in the figure window, click on the points (0.5,0.5) and (2,2).
Back in the command window you should get something like
total_line_integral = 0.7623, depending upon how close you are to
(0.5,0.5) and (2,2). How much work is done?
c. Now, we’ll see what happens as we use 2 segments: start at (0.5,0.5),
move to (1.5,1), and then up to (2,2). What is the work done on each
segment, and what is the total work?
d. Now, try various paths (of however many segments you choose) from
(0.5,0.5) to (2,2) to see how you can make the work along the path
nonnegative and as small as possible. Include a graph showing the path
and give the total work.

5. Another way of looking at whether the vector field F  x, y   u  x, y iˆ  v x, y  ˆj is
conservative (or a gradient vector field) or not is to recall some factoids about

gradients and multivariable functions. If F x, y  is conservative, then we know
that u x, y   f x and v x, y   f y for some multivariable function f x, y  . Since
we know that all “nice” multivariable functions have their mixed second partials
equal, f xy  f yx , we should have f yx  f xy  0 if the vector field is conservative.
We have yet a third treat for you today – the curl m-file. And once again, the
syntax should look familiar: curl(u(x,y), v(x,y) ,[lo-x hi-x lo-y hi-y])
Curl graphs the vector field, and overlays a color grid whose shade represents s
the value of f yx  f xy at each point in the rectangle. So… when we see orange
everywhere, you can rest assured that your vector field has f yx  f xy  0 and is
conservative! Whoo hoo!

a. For the vector field F  sin  xyiˆ   x  y  ˆj , from (3) and (4), where is the
quantity f yx  f xy the greatest? Where is it the smallest? What, if any,
differences do you see in the vector field between these areas?
b. How does the value f yx  f xy relate to the path you took when minimizing
the work in (4D)? In other words, is this value positive or negative and is
it large in magnitude or small in magnitude?
6. Repeat (5a) for the following vector fields:
a.

F   x  sin  y iˆ   x cos y  ˆj over the interval [1 4 -2 2]


 
x
iˆ  
2
2
2
 x  y   x  y2

 
b. F  
y

 ˆj over the interval [-2 2 -2 2]


c. Based on your observations, do you have any intuition why the quantity
f yx  f xy is called “the magnitude of the curl of a 2-D vector field” and
what this would mean?
7. And now for something completely different… an applied problem!
A simple model of the flow of a viscous fluid in a channel with “no-slip” boundary
conditions – meaning that the fluid “sticks” to the walls, is given by

F  1  y 2 iˆ  0 x  ˆj with –1 ≤ y ≤ 1. The fluid flows from left to right through
the channel whose walls are the lines y = +/- 1.
a. Graph this vector field over the interval 0 ≤ x ≤ 5 and –1 ≤ y ≤ 1.
b. Where on the graph would you expect the magnitude of f yx  f xy to be
the greatest? Where would you expect it to be smallest?
c. Graph the curl of the vector field over the interval 0 ≤ x ≤ 5 and –1 ≤ y ≤ 1.
How did your predictions from (b) work out? Explain.
Download