I wanted a set ("list") of 100 random vectors of dimension 2. I accomplished this already by generating a "list of lists" where the elements of the overall list are 2-dimensional lists consisting of 2 random numbers. Of course, each of these 2-dimensional lists are the vectors, and there are 100 of them. I accomplished this as follows:
vectors = Transpose[{RandomReal[{-1, 1}, 100], RandomReal[{-1, 1}, 100]}]
I know that I can find the norm of each of those vectors by mapping the Norm
function onto the overall list, like so:
norms = Map[Norm,vectors]
That is a list of 100 numbers. What I want to do now is multiply each of the vectors by their respective norms. (Note that I am not talking about normalizing them which could've simply been done by coding: Map[Normalize,vectors]
.)
Essentially, I'd like a one-to-one mapping where element 1 of the list "vectors" is multiplied by element 1 of the list "norms". I'm not sure how to do this. I thought of defining a new function where the argument would be a list (one of those 2-dimensional lists in the list "vectors" above) and the function would multiply the argument by its norm. However, I'm not sure how to program this function or if this is even an efficient way to do it. How could I define this so-called one-to-one mapping?
(My ultimate goal is to plot my resulting vectors, and then run a loop doing this over and over many times.)