Direction Field Examples
| > | with(DEtools): |
Direction field for dy/dx = x^2 - y (this you should have done in Math 305). Here y is a function of x, so wewrite y(x), while x is an indepentdent variable.
| > | dfieldplot(diff(y(x),x) = x^2 - y(x) , y(x) , x=-5..5, y=-5..5 , arrows=line); |
![[Plot]](images/dvfields_1.gif)
| > |
Now we plot a direction field for a 2x2 system. Note , the system is autonomus but nonlinear. We will see that there are two fixed points, points where the <x', y'> = <0,0>. One is at the origin. Try to find the location of the other fixed point.
| > | dfieldplot([diff(x(t),t)=x(t)*(1-y(t)), diff(y(t),t)=.3*y(t)*(x(t)-1)],
[x(t),y(t)],t=-2..2, x=-1..2, y=-1..2); |
![[Plot]](images/dvfields_2.gif)
Next we redo the field above, but plot a true vector field. That is the lengths of the vector are not al set to 1, but they are scaled so that the largest vector has length one..
| > | with(plots): |
Warning, the name changecoords has been redefined
| > | fieldplot([x*(1-y), .3*y*(x-1)], x=-1..2, y=-1..2);
|
![[Plot]](images/dvfields_3.gif)
Below I plotted the true vector field, tat is, without any scaling. The vector is in the form [< a,b >, <c,d>], that is te base is at <a,b> and the head is at <c,d>. The indices i and j represent 1/4 inch grid points, hence x = i/4 and y=j/4.
| > | arrow([seq(seq([<i/4,j/4>,<(i/4)*(1-j/4),0.3*(j/4)*(i/4-1)>] ,i=-4..8),j=-4..8)], shape=arrow); |
![[Plot]](images/dvfields_4.gif)
| > |