Slope Fields with Mathematica

Our Preliminary Example inÌýMathematica

(continued fromÌýlast page...)

MathematicaÌýshould have responded with the following description of theÌýVectorPlotÌýcommand:

VectorPlot Syntax

The first of these three versions of the command is more than enough for the simple task we have in mind. If you have not yet taken vector calculus, then some explanation is in order. The description refers to aÌývector fieldÌý{vx,vy}. The notation here is a little confusing to the novice. A vector field, in this context, can be thought of as being defined by a two dimensionalÌývector functionÌý{vx,vy},Ìýwhich has two coordinates,ÌývxÌýandÌývy, where each of these can be functions ofÌýbothÌýxÌýandÌýyÌýin their own right!

Now we wish to useÌýVectorPlotÌýto create theÌýslope fieldsÌýwe've been discussing since the start of the lab! We want the vectors that it draws for us to all have theÌýslopeÌýdictated by the original differential equation at each individual point, (x,Ìýy).

Recall that the introductory differential equation we've been using so far is:

dy/dxÌý=Ìýx2

For this equation we would like the vectors plotted byÌýVectorPlotÌýto have aÌýslope ofÌýx2Ìýat each and every point (x,Ìýy) chosen to be part of our plot. Since slope is so easy to think about asÌýrise/run, we could think of theÌýslopesÌýthat we're seeking here as beingÌýx2/1, i.e. having a rise ofÌýx2, and a run of 1.

A few minutes ago I referred to the vector valued function,{vx,vy}. Here, the first coordinate, vx, dictates the length of each vector in theÌýx-direction, and the second coordinate,Ìývy, dictates the length of each vector in theÌýy-direction, i.e. using this terminology, our vectors will have aÌýriseÌýofÌývx, and aÌýrunÌýofÌývy. But we've just said that for our example we want ourÌýslope-field vectorsÌýto have aÌýriseÌýofÌýx2, and aÌýrunÌýof 1. This would be achieved if we simply let

vy=Ìýx2,

and

vxÌý= 1.

So, making these substitutions into theÌýVectorPlotÌýsyntax discussed above, and taking into account that we had also suggested we plot a slope field with bounds:

-2 ≤ÌýxÌý≤ 2, and -2 ≤ÌýyÌý≤ 2

our first example would require us to type:

VectorPlot[{1,x^2}, {x, -2, 2}, {y, -2, 2}]

Switch over toÌýMathematicaÌýnow, and either copy and paste or type the above command, hitting ENTER to evaluate it. Come back here when you're done.

Let's nowÌýgo and seeÌýwhat you should have gotten.

Ìý


Compass If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.