This question is about animating a plot of 3d points in Maple.
Consider the parametric function
$$f(t)=(0,\cos{t},\sin{t})$$
Let's create a matrix of twenty points of this function, each row being a point.
pd := Matrix([seq(f(t), t = 0 .. 20)]);
We can plot these points
pointplot3d(pd)
to obtain
Now, imagine we want to have an animation that plots a rolling window of five points. That is, first we plot rows 1-5, then rows 2-6, then 3-7, and so on.
I thought about implementing this as follows
with(plots):
animate(pointplot3d, [pd[t .. t + 5, () .. ()]], t = [1, 2, 3, 4, 5])
However, I get an error
Error, non-integer ranges in Matrix index
The indexing of the matrix is being done using values of $t$ from $1$ to $5$, if I understand correctly.
Here is a similar example that also uses a list for this same parameter to animate
animate(plot3d, [[sin(q^2 + q)*cos(q), sin(q^2 + q)*sin(q), cos(q^2 + q)], q = s - 1 .. s], s = [seq(i, i = 1 .. 5)], frames = 100)
This produces the correct animation.
I would like to attach my worksheet, but I can't see how.
In any case, why does the first use of animate not work?
EDIT: the following workaround seems to work
m1 := proc(pd, t)
return pointplot3d(pd[t .. t + 5, () .. ()]);
end proc
animate(m1, [pd, t], t = [seq(i, i = 1 .. 15)])
What I am doing with this code is passing my own function as the first parameter to pointplot3d. The docs say this first parameter is a
Maple procedure that generates a 2-D or 3-D plot or plot objects
I wasn't sure if this would work because when I check the return value of pointplot3d it is a function. I am not sure how the type system is in Maple. But this did work. And when I print out the value of t in the function m1 they seem to be integers.
Not sure why the original (easier) way isn't working.
