• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Browse and search Google Drive and Gmail attachments (plus Dropbox and Slack files) with a unified tool for working with your cloud files. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!



Page history last edited by Russell Blyth 10 years, 1 month ago

Slope Fields and ODEs with GeoGebra 4.0


Creating a Slope Field- version 1


For the first version, we have a function f(x,y) and display the field vector at (x,y) as (1,f(x,y)). Start with a new window. We want to use Graphics View 2 as a place for sliders and values. We toggle the axes off in Graphics View 2.


We add in a slider for VectorDensity, which is set as an integer from 1 to 30, and VectorScale, which ranges from 0.01 to 1.


We want to add a grid of points that cover the graphing window. We will divide the graphing window into VectorDensity subintervals from left to right and from bottom to top. We use the Corner command with Corner[1] being the coordinates of the lower left corner of the Graphics view and Corner[3] being the upper right corner.


Now we use the Sequence command twice to build a sequence of grid points. We use the Join command to convert from a sequence of sequences to a simple sequence. We use the Length command to find the number of elements in that list of points.


We are ready to define the slope field. We define f(x,y) to initially be x/2. This slope field corresponds to functions of the form F(x)=x^2/4+c. We also create an arbitrary point A. We want a vector that starts at A and has displacement VectorScale*(1,f(A)).


Now we want to go through the list of GridPoints and add a similar vector for each gridpoint. We use the command

GridVecs=Sequence[Vector[Element[GridPoints,k], Element[GridPoints,k] + VectorScale (1, f(Element[GridPoints,k]))],k,1,NumPoints]


Adding a Solution Curve


We create texts with the values of A and f to clean things up. We also are ready to add a solution curve. We create a point B, then use the SolveODE command to create a solution curve that starts at B. We use the command



Creating a Slope Field and solution curves- version 2


For the second version, we have two functions, Dx(x,y) and Dy(x,y) and the field vector at (x,y) is (Dx(x,y), Dy(x,y)). We will explore the example where Dx(x,y)=-y and Dy(x,y)=x. The solution curves are circles. We add an extra slider for the maximum value of our parameter t.


We use VecA2 = Vector[A, A + VectorScale (Dx(A), Dy(A))] to create the sample vector at point A. For the slope field we use


GridVecs2 = Sequence[Vector[Element[GridPoints, k], Element[GridPoints, k] + VectorScale (Dx(Element[GridPoints, k]), Dy(Element[GridPoints, k]))], k, 1, NumPoints]


We create the path with

PathB2 = SolveODE[Dy, Dx, x(B), y(B), tMax, tMax / 500]. (Note that the command "SolveODE" asks for y', then x'.)


You can download a pdf version SlopeFieldsGeoGebra4.pdf of this document.

© 2011, Mike May, S.J.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license, Mike May, S.J. maymk@slu.edu


Comments (0)

You don't have permission to comment on this page.