Help Translating a Sequence of Vectors

Dave Yrueta shared this question 2 years ago
Answered

Hi All --

I'm trying to create a vector field representation using this command --

Sequence(Translate(Vector(Point({P(flst(i)), Q(flst(i))})), flst(i)), i, 1, Length(flst))

-- where "flst" is a flattened list-of-points, and P, Q are component functions. What I want is sequence of vectors, each translated to its "input" point; what I get is a sequence of vectors translated to the last point in flst. I can't for the life of me figure out why this is the case.

Here's a link to the file: https://www.geogebra.org/cl...

along with a screenshot. Any help obtaining the desired result would be greatly appreciated!

Thank you,

Dave Yrueta

Comments (9)

photo
1

Based on a comment to a similar question raised by a user about 3 years ago, I was able to write a command that used the start point, end point parameters of a vector function to produce the translation:

Sequence(Vector(flst(i), Point({P(flst(i)) + x(flst(i)), Q(flst(i)) + y(flst(i))})), i, 1, Length(flst))

Is this a bug in the Translation function, or did I do something wrong?

photo
1

Looks like a bug to me: It seems that when Translate( <Vector>, <Start Point> ) is used within Sequence, and <Start Point> depends on the sequence vaiable, then always the end value of the sequence variable (instead of the running value) is used there. Here's a small example to illustrate this:

Sequence(Translate(Vector((0, 1)), (i, 0)), i, 1, 2)

You would expect to see the vector (0, 1) shown once at starting position (1,0) and once at starting position (2,0), but they are both drawn at starting position (2,0).

Don't know how the positioning information is handled internally (mathematically it's not a defining property of a vector), but considering that constructing your vector sequence from starting and end points works properly (incl. the positioning), I assume that it's feasible to fix this.

photo
1

Thank you artydent --

It seems like a bug to me too. Thanks for your comments -- much appreciated!

photo
1

Hi artydent,

Replace your illustrative statement:

Sequence(Translate(Vector((0, 1)), (i, 0)), i, 1, 2)

by the following statement to achieve the desired effect:

Sequence(Vector((i, 0), (i, 1)), i, 1, 2)

Still better, slider j = 1, Sequence(Vector((i, 0), (i, 1)), i, 1, j)

photo
1

I know how to produce the desired result. This was merely a small example to illustrate that Translate within Sequence is not doing what one would expect, possibly because of a bug.

photo
photo
1

Is the command SlopeField what you need, perhaps? https://wiki.geogebra.org/e...

photo
1

Hi Simona -- Not quite. I want to equip students with the ability to input the component vector functions on their own. I don't quite see how that would be possible with SlopeField. But thank you for bringing it my attention! I didn't know it even existed.

photo
photo
1

Yo, para trasladar el vector u según el vector v, uso Vector(Translate(Point(u, 0), v), Translate(Point(u, 1), v))

photo
1

Hi Mathmagic --

Thank you, I'll give it a try, although the syntax is a bit more complicated than I hoped for, and as I noted, I've already implemented a workaround. But I appreciate the reply!

photo
© 2023 International GeoGebra Institute