Vector based on a set and in the order of another vector

20 Views Asked by At

This feels like a very basic question, so I hope I am not in the wrong place.

I have a set of (color, value) pairs CV={(color_1,value_1), (color_2,value_2) ...} and a vector of colors color = [color_2, color_3, color_1,...].

I want to formally define the vector Value as the values in CV but in the order that the corresponding color appears in the color vector.

Is there a more mathematically exact way of writing this?

Example: CV = {(orange, 7), (red, 3), (blue, 91), (green,22)} and color=[red, blue, green, orange]. Now Value should be Value = [3, 91, 22, 7].

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

CV defines a map mapping colors to values. Hence we can write $Value = (CV(color_i))_{i=1}^n$, where $n$ is the given dimension.