udibehar
(Ehud Behar)
1
I have the following list of vectors:
vecs = {
{a1, a2},
{b1, b2},
{c1, c2},
{d1, d2},
{e1, e2},
{f1, f2}
}
and I want to generate the following list:
{
Arrow[{{0, 0}, {a1, a2}}],
Arrow[{{a1, a2}, {b1, b2}}],
Arrow[{{b1, b2}, {c1, c2}}],
Arrow[{{c1, c2}, {d1, d2}}],
Arrow[{{d1, d2}, {e1, e2}}],
Arrow[{{e1, e2}, {f1, f2}}]
}
How can I do that?
eric3
(Eric Rimbey)
2
Here’s one way:
Arrow /@ Partition[vecs, 2, 1, {-1, -1}, {{0, 0}}]
udibehar
(Ehud Behar)
3
First time that I make use of the function Partition. Very nice and thank you very much!
Here is another way - a single line with several arrow heads:
{Arrowheads[{0, 0.1, 0.1, 0.1, 0.1, 0.1}], Arrow[vecs]}
EDIT: Works best if all vectors have the same lenght.