# Help with plotting vector fields

1. Oct 8, 2011

### smithnya

I'm having difficulty plotting a vector field of a first-order system. I understand that I am supposed to select various points, "plug" them into the equations, and then plot the vector from the resulting point. But how do I know in which way the vector is pointing? Once I get the point from which the vector will originate, how do I decide in which direction to point that vector? Also, what do I do if I get a system such as dx/dt = x, dy/dt = 1? How would I plot dy/dt being that it is a constant?

2. Oct 9, 2011

### jackmell

The "vectors" are slopes. You can draw a small line with a particular slope right? For example, take:

$$\frac{dy}{dt}=2y+1$$

At the point (1,2), the slope is 5. So at that point in the plot, draw a small arrow with slope five. The slope at the point (-3,-1) would be -1. So draw a small line with a slope of -1. Same dif everywhere else. Since this one doesn't depend on t, the slope field is symmetrical with respect to the t-axis right?

In the case of a system:

$$dx/dt=x$$
$$dy/dt=1$$

the slope field is now in the x-y coordinate system so at the point x=1, y=2, the slope would be 1. Draw a line with slope 1 there. At the point x=5, y=3, the slope is five. Do the same there.

To check your work, use Mathematica's StreamPlot function. In the case of the single DE above, then dt/dt=1 and dy/dt=2y+1 so that in the t-y coordinate system, we can code:

StreamPlot[{x, 1}, {x, -5, 5}, {y, -5, 5}]

and for systems like the one above:

StreamPlot[{x,1},{x,-5,5},{y,-5,5}]