Mathematics & Science
Learning Center |
|||
Slope Fields with MathematicaOur Preliminary Example in Mathematica(continued from last page...) Mathematica should have responded with the following description of the VectorPlot command: 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 {v_{x},v_{y}}. 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 {v_{x},v_{y}}, which has two coordinates, v_{x} and v_{y}, 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: For this equation we would like the vectors plotted by VectorPlot to have a slope of x^{2} 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 x^{2}/1, i.e. having a rise of x^{2}, and a run of 1. A few minutes ago I referred to the vector valued function,{v_{x},v_{y}}. Here, the first coordinate, v_{x}, dictates the length of each vector in the x-direction, and the second coordinate, v_{y}, dictates the length of each vector in the y-direction, i.e. using this terminology, our vectors will have a rise of v_{x}, and a run of v_{y}. But we've just said that for our example we want our slope-field vectors to have a rise of x^{2}, and a run of 1. This would be achieved if we simply let v_{y}= x^{2}, and v_{x} = 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: 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. |
|||
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 |