| Author |
Comment/Response |
John Leko
|
09/16/00 08:38am
>How do you make a two dimensional vector from two one dimensional vectors. Say vector A ={x1,...,xn} and B = {y1,...,yn} and I want to make a vector C = {[x1,y1],...,[xn,yn]}. Any help would be greatly appreciated.
First of all, I am assuming that what you want, in Mathematica parlance, is {{x1, y1}, {x2, y2}, ...{xn, yn}}, not ''{[x1,y1],...,[xn,yn]}''.
First, I need to create two vectors:
In[4]:=
a = Table[i, {i, 5}]
b = Table[j + 5, {j, 5}]
Out[4]= {1, 2, 3, 4, 5}
Out[5]= {6, 7, 8, 9, 10}
Now, to reconfigure these I do the following:
In[6]:= Transpose[{a, b}]
Out[6]= {{1, 6}, {2, 7}, {3, 8}, {4, 9}, {5, 10}}
URL: , |
|