# Direction Field, n=2

This applet draws solution curves in the phase plane of a 2x2 autonomous system of Ordinary Differential Equations over the systems direction field. The system is of the form:
```    x' = f1(x,y)
y' = f2(x,y)```
or
`x'=Ax  where x is a 2x1 vector and A is a 2x2 matrix`

The vector at a point [x(t),y(t)] is given by <f1(x[t],y[t]),f2(x[t],y[t])> with the field being represented in the applet as a "direction field" of arrows. The arrow at a given point points in the direction of the vector at that point, but the length of the vector is not represented. You can start a solution curve at a given initial point by clicking the mouse at that point. You can also enter the x and y coords of the initial point in the text input boxes labeled "x0=" and "y0=". Press return in one of these input boxes or click the green start button to start the curve. The curves are animated. At each step of the animation, a new segment of each curve is computed and drawn. The segment represents an approximation of the exact solution curve over a time interval of length dt. The approximation method can be either be a four stage, 8th order implicit Gauss method, explicit Runge-Kutta order 4, explicit Runge-Kutta order 2, or explicit Euler's method. The implicit Gauss method is implemented using functional iteration for simplicity. You can stop the progress of the curves by clicking the red stop button. The curves will also be stopped automatically if their coordinates become undefined or unreasonably large. You can clear any curves that have been drawn by clicking the Clear button. Curves will also be cleared if a new vector field is drawn. Click the button below and the applet with open in a new window.

## Examples

### Linear (default example)

f1=a*x + b*y and f2=c*x + d*y;

• the default values are a=-0.1, b=1, c=-1, and d=-0.1, which results in the phase portrait being a spiral. A has complex eigenvalues.
• a=0, b=1, c=-1, and d=0 results in the phase portrait being a center. A has purely complex eigenvalues.
• a=1, b=1, c=4, and d=1 results in the phase portrait being a saddle point. A has real eigenvalues of oppsite sign.
• a=-3, b=sqrt(2), c=sqrt(2), and d=-2 results in the phase portrait being a node. A has real eigenvalues of the same sign. The critical point x=0 is stable since both eigenvalues are negative.
• a=1, b=-1, c=1, and d=3 results in the phase portrait being an improper node. A has a repeated eigenvalue with only one linearly independent eigenvector.

### Oscillating Pendulum - Damped and Undamped

The second order ODE u'' + a*u' + c*sin(u)=0 converted to the system f1=y and f2=c*sin(x) - a*y; To get the undamped pendulum, set a=0.

### Predator-Prey

f1=x*(a-b*y) and f2=y*(-c+d*x); The parameters a and c are the growth rate of the prey and the death rate of the predator, respectively, and b and d are measures of the effect of the interactions between the two species.

### Competing Species

f1=x*(e1 - s1*x -a1*y) and f2=y*(e2 - s2*y -a2*x); The six parameters depend on the species under consideration: e1 and e2 are growth rates, e1/s1 and e2/s2 are saturation levels, and a1 is the degree to which species y interferes with species x.

### van der Pol equation

the second order ODE u'' - a(1-u^2)u' + u=0 converted to the system f1=y and f2=-x + a*(1-x^2)*y; Try different values of a such that 0<a<5.