### 54.1 Introduction to drawdf

The function `drawdf` draws the direction field of a first-order Ordinary Differential Equation (ODE) or a system of two autonomous first-order ODE’s.

Since this is an additional package, in order to use it you must first load it with `load("drawdf")`. Drawdf is built upon the `draw` package, which requires Gnuplot 4.2.

To plot the direction field of a single ODE, the ODE must be written in the form:

           dy
           -- = F(x,y)
           dx

and the function F should be given as the argument for `drawdf`. If the independent and dependent variables are not x, and y, as in the equation above, then those two variables should be named explicitly in a list given as an argument to the drawdf command (see the examples).

To plot the direction field of a set of two autonomous ODE’s, they must be written in the form

           dx             dy
           -- = G(x,y)    -- = F(x,y)
           dt             dt

and the argument for `drawdf` should be a list with the two functions G and F, in that order; namely, the first expression in the list will be taken to be the time derivative of the variable represented on the horizontal axis, and the second expression will be the time derivative of the variable represented on the vertical axis. Those two variables do not have to be x and y, but if they are not, then the second argument given to drawdf must be another list naming the two variables, first the one on the horizontal axis and then the one on the vertical axis.

If only one ODE is given, `drawdf` will implicitly admit `x=t`, and `G(x,y)=1`, transforming the non-autonomous equation into a system of two autonomous equations.

Categories:Differential equations ·Plotting ·Share packages ·Package drawdf ·Package draw ·