So I was trying to create a shorthand for creating a plot of multiple arrows, with the arrow colour dependent on the magnitude of the vector.
I currently have a set of vectors, v, I want to display, and v is the largest.
I know this could be done by creating an arrow plot for each vector seperately and then by combining them using display:
arrow1 := arrow( v, width=0.15,length=20,color=ColorTools:-Color( (norm(v)/norm(v))*[0,0,1] ) );
arrow2 := arrow( v, width=0.15,length=20,color=ColorTools:-Color( (norm(v)/norm(v))*[0,0,1] ) );
print(plots:-display([arrow1, arrow2, ...]));
But I was wondering if it could be done in a fashion similar to this:
arrows := arrow([seq(v[i], i=1..4)],width=0.15,length=20,color=ColorTools:-Color((norm(v[i])/norm(v))*[0,0,1]));
The sequence iterates through the vectors in v, so it plots all arrows as if you'd just put the set v directly in there.
But I did it this way in hope that the variable i would somehow remain for the whole line, so it could then be used to set the colour of the vector.
As you may have guessed it compains that it cannot find the variable i.
I was wondering if anyone knows a way to do this?
(btw: it works fine replacing the last i with 1, which draws all arrows nearly black, or with 4, which as you guessed, draws all arrows blue...)