Delta Banner

Mathematics & Science Learning Center
Computer Laboratory

 

Slope Fields with Mathematica

Tweaking The Preliminary Example

(continued from last page...)

Hopefully you successfully managed to get a reasonable picture of a slope field during your little trip over to Mathematica. The slope field you got should have been very much like the following:

Preliminary Slope Field Graph

Our preliminary example as drawn by Mathematica

The fact that we got a slope field at all, without having to do huge numbers of calculations by hand, is somewhat encouraging, but there are a couple of things about this plot that could use some improvement. First, the VectorPlot command seems to default to drawing little arrow heads on each vector that it renders. While this is useful when studying vectors in their own right, in the context of slope fields, these are less necessary, (though they do have their uses,) and to some extent they clutter the image. Second, it looks like VectorPlot defaults to leaving the x- and y-axes off of the graph. Let's deal with these complaints by adding some options to the VectorPlot command we used on the last page, as follows:

VectorPlot[{1, x^2}, {x, -2, 2}, {y, -2, 2},
VectorStyle -> Arrowheads[0], Axes -> True]

The two options we've added are self-explanatory. The first says that the arrow heads should be left off, and the second asks for the axes to be included.

Switch back to Mathematica and enter the above command, looking carefully at the resulting graph, then return here.

Let's now go and see what you should have gotten this time.


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.
 
 

ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA
e-mail:
cbarker@deltacollege.edu