Friday, June 29, 2007

English Vietnamese

Tôi không uống được rượu = Wine does not agree with me

Saturday, June 9, 2007

How to sketch a vector field in Maple

Original text from UIC.

When is a Vector field a Gradient vector field?

Department of Mathematics, Statistics and Computer Science

University of Illinois at Chicago

by Paul Brown, Heidi Burgiel, Marc Culler, Heather Dye and John Wood

Copyright © 1999, The University of Illinois at Chicago

Maple is a registered trademark of Waterloo Maple Software



Introduction

The purpose of this lab is to impart a graphical understanding of the idea of a conservative vector field. You will learn how to use Maple to work with vectors and vector fields and you will learn a visual way of determining which vector fields could be gradient vector fields.

Vector Fields

A vector field is given by a function F that assigns a vector in the plane (or in n -dimensional space) to each point in the plane (or in n -dimensional space). In other words, F(x,y) specifies a direction and magnitude at each point (x,y) . Vector fields are commonly used to model natural and physical phenomena such as wind and water velocity, magnetic fields, electric fields, or gravitational forces. Of course, you are already familiar with many examples of vector fields - the gradient of any differentiable function is a vector field.

Given a vector valued function F(x,y) , we can write each component of F as a function:

F(x,y) = [F1(x,y), F2(x,y)]

where F1 and F2 are scalar functions like those we have been studying througout this course. We can visualize the values of F by imagining that attached to a point (x,y) in the plane is an arrow representing the vector F(x,y) .

Vector Fields in Maple

A vector field is described by a function that takes each point of the plane to a vector.

> with(linalg):

> F := (x,y) -> [-y,x];

[Maple Math]

We can evaluate this function at a point by plugging in values for x and y , just like we do with functions whose values are scalars.

> F(1,4);

[Maple Math]

To visualize the vector field generated by a function F , we choose some points (x,y) in the plane and draw the vectors F(x,y) with their "tails" at point (x,y) . If some vectors F(x,y) are very large, Maple will scale all the vectors it draws to make the vector field easier to understand. Below we use Maple to draw the vector field associated with the function F defined above.

> with(plots):

> fieldplot(F(x,y), x=-1..1, y=-1..1);

Exercise 1

Just as when plotting surfaces, it is important to choose your domain rectangle carefully. Use Maple to the vector valued function G(x,y) = [sin(y), cos(x)] . Look at this vector field on squares between .1 unit on a side to 100 units on a side. Choose the x - and y -ranges which give you the best picture of how the function behaves on the entire plane (too big, and you won't be able to see the details; too small and you'll only know the local behavior, not the global.) Sketch or print this vector field and turn it in.

Gradient Vector Fields

Taking the gradient of a function of two or more variables is much like taking the derivative of a function of one variable. So, as in one-variable calculus, it is natural to try to find "antiderivatives" for the vector fields. That is, we will start with a vector field F(x,y) and try to find a function f(x,y) such that F is the gradient of f . If such a function f exists, it is called a potential function for F .

Finding potential functions for vector fields is very different from the one variable problem. Any continuous function of one variable has an antiderivative (the "area under the curve") but most vector fields are not gradient vector fields.

Exercise 2

Decide whether the following statements are true or false:

a) (x^2 + y^2)/2 is a potential function for the vector field G1(x,y) = [x,y] .

b) The vector field given by G2(x,y) = [0,0] is the gradient vector field of a function whose graph is a horizontal plane.

Exercise 3

How is the gradient of a function of two variables similar to the derivative of a function of one variable? How is the gradient of a function of two variables different from the derivative of a function of one variable?

If a vector valued function F has a potential function f , we say that F is conservative . Before attempting to find a potential function for the field F , we would like to find out whether that is possible. Sometimes we can tell that a function is not conservative by looking at a plot of its vector field. The vector fields plotted below are all conservative -- i.e. each one is the gradient field of a function (can you guess the function?)

> fieldplot([2*x,0], x=-2..2, y=-2..2, grid=[12,12], arrows=SLIM, color=BLUE, scaling=CONSTRAINED);

> fieldplot([2*x, 2*y], x=-2..2, y=-2..2, grid=[12,12], arrows=SLIM, color=BLUE, scaling=CONSTRAINED);

> fieldplot([.9*x^2-1, 2*y], x=-2..2, y=-2..2, color=BLUE, arrows=SLIM, scaling=CONSTRAINED);

> fieldplot([1/(1+y^2), x*y/(1+y^2)^2], x=-2..2, y=-2..2, arrows=slim, color=BLUE, grid=[12,12], scaling=CONSTRAINED);

The next three plots are of vector fields that are not gradient fields for any function.

> fieldplot(F(x,y), x=-2..2, y=-2..2, color=BLUE, grid=[12,12], arrows=SLIM, scaling=CONSTRAINED);

> fieldplot([sin(y), cos(x)], x=-5..5, y=-5..5, arrows=SLIM, color=BLUE, scaling=CONSTRAINED);

> fieldplot([y^3-x^2+5,y-x^3-5], x=-3..1, y=-2..2, grid=[15,15], arrows=SLIM, color=BLUE, scaling=CONSTRAINED);

As you may have guessed, the big difference between conservative and non-conservative vector fields is that non-conservative vector fields each have a place where their vectors "swirl around".

In our discussion of finding maxima of functions using their gradient vectors, we said that the function's values increase as you follow the direction of the gradient vectors. In a non-conservative vector field, you might follow the direction of the vectors and end up back where you started! If you started at point (x,y) , this would lead you to conclude that any function f that had this vector field as a gradient vector field must have the property that f(x,y) > f(x,y) . Impossible!

Exercise 4

Which of the vector fields shown below are not conservative?

> fieldplot([-x/sqrt(x^2+y^2),-y/sqrt(x^2+y^2)], x=-2..2, y=-2..2, color=BLUE, arrows=SLIM, grid=[10,10], title=A, scaling=CONSTRAINED);

> fieldplot([y-x/2,-x-y/2], x=-2..2, y=-2..2, color=BLUE, arrows=SLIM, grid=[10,10], scaling=CONSTRAINED, title=B);

> fieldplot([y, x], x=-2..2, y=-2..2, color=BLUE, arrows=SLIM, grid=[10,10], scaling=CONSTRAINED, title=C);

> fieldplot([x^3+y-1, y^3-x], x=-1.5..1.5, y=-1.5..1.5, arrows=SLIM, color=BLUE, grid=[12,12], scaling=CONSTRAINED, title=D);