# Question:plotting arrows at fixed time intervals

## Question:plotting arrows at fixed time intervals

Maple

I would like to customize arrows of motion in a phase diagram. The system is the following, with critical point (1,1):

```xdot := diff(x(t),t) = x(t)-y(t):
ydot := diff(y(t),t) = y(t)*(1-x(t)):

```

with phase diagram (the black line is the stable manifold of the system): Take a series of initial values such as x(0)=0.2 and y(0)=0.08 and plot arrows at time t=0,1,2,3,4,5, .... This would be a device to indicate the speed of motion of some representative trajectories that are off the stable manifold.

For instance, I would like to fix x(0)=0.2 and let y(0) vary around 0.08 and plot a series of arrows at all dates t such that the trajectory x(t),y(t) remains within the plot (all trajectories other than the stable manifold leave the scene [0..2,0..2] in finite time)

I know how to do that by "manually" selecting initial values. What I don't know is how to make this a little systematic. At the very least, cut down the number of lines with either a loop or a clever use of "seq." I can sort of do a loop, but it doesn't work terribly well (the trajectories leave the plot after different lengths of time and I don't know how to handle lists of different lengths in a loop). I suspect seq would be the method of choice here, but I don't know how to use seq at all.

So below is the awkward code I wrote together with the output. If anyone can help me rewrite it in a more compact form with seq, I should be very grateful.

```restart:
xdot := diff(x(t),t) = x(t)-y(t):
ydot := diff(y(t),t) = y(t)*(1-x(t)):
x0:=0.2: y0:=0.08:
DEsol := dsolve(
{xdot,ydot} union {x(0)=x0,y(0)=y0},
type=numeric,
output=listprocedure
):

xsol := eval(x(t),DEsol):
ysol := eval(y(t),DEsol):
init1 := [ [xsol(0),ysol(0)], [xsol(1),ysol(1)], [xsol(2),ysol(2)],
[xsol(3),ysol(3)], [xsol(4),ysol(4)], [xsol(5),ysol(5)], [xsol(6),ysol(6)] ]:
x0:=0.2: y0:=0.085:
DEsol := dsolve(
{xdot,ydot} union {x(0)=x0,y(0)=y0},
type=numeric,
output=listprocedure
):

xsol := eval(x(t),DEsol):
ysol := eval(y(t),DEsol):
init2 := [ [xsol(0),ysol(0)], [xsol(1),ysol(1)], [xsol(2),ysol(2)],
[xsol(3),ysol(3)], [xsol(4),ysol(4)], [xsol(5),ysol(5)], [xsol(6),ysol(6)] ]:
x0:=0.2: y0:=0.0873:
DEsol := dsolve(
{xdot,ydot} union {x(0)=x0,y(0)=y0},
type=numeric,
output=listprocedure
):

xsol := eval(x(t),DEsol):
ysol := eval(y(t),DEsol):
init3 := [ [xsol(0),ysol(0)], [xsol(1),ysol(1)], [xsol(2),ysol(2)],
[xsol(3),ysol(3)], [xsol(4),ysol(4)], [xsol(5),ysol(5)], [xsol(6),ysol(6)], [xsol(7),ysol(7)], [xsol(8),ysol(8)], [xsol(9),ysol(9)]]:
x0:=0.2: y0:=0.088:
DEsol := dsolve(
{xdot,ydot} union {x(0)=x0,y(0)=y0},
type=numeric,
output=listprocedure
):

xsol := eval(x(t),DEsol):
ysol := eval(y(t),DEsol):
init4 := [ [xsol(0),ysol(0)], [xsol(1),ysol(1)], [xsol(2),ysol(2)],
[xsol(3),ysol(3)], [xsol(4),ysol(4)], [xsol(5),ysol(5)], [xsol(6),ysol(6)]  ]:
init := [op(init1), op(init2), op(init3), op(init4)]:
DEtools[DEplot](
{xdot,ydot},
{x(t),y(t)},
t=-20..0,
[[x(0)=0.9999,y(0)=0.9999],[x(0)=1.0001,y(0)=1.0001]],
scene=[x(t),y(t)],
x=0..2, y=0..2,
arrows=smalltwo,
dirfield=init,
#  size=magnitude,
#  color=magnitude,
linecolor=black,
thickness=6,
numpoints=1000
);
``` I you wonder what I'm doing here, the point of drawing arrows at fixed points in time, starting from a small neighborhood of x(0)=0.2, is to show that as the motion slides off the stable manifold it gathers speed and quickly diverges out of the picture. I don't think there's a built-in routine for this now, is there? ﻿