Re: Re: How to construct a vector whose elements are also vectors?
- To: mathgroup at smc.vnet.net
- Subject: [mg82943] Re: [mg82870] Re: How to construct a vector whose elements are also vectors?
- From: "Guofeng Zhang" <guofengzhang at gmail.com>
- Date: Sun, 4 Nov 2007 06:09:37 -0500 (EST)
- References: <fg9peo$ms0$1@smc.vnet.net> <200711011026.FAA09034@smc.vnet.net>
Thanks a lot. On 11/1/07, Szabolcs Horv=E1t <szhorvat at gmail.com> wrote: > > Guofeng Zhang wrote: > > Hi, there, > > I'd like to construct a vector whose elements are also vectors. I > used > > the following conmands: > > Please do read some of the tutorials in the documentation. If you have > an older version, start reading the Mathematica book from the beginning. > If you have version 6, then at least read all of the tutorials from > guide/LanguageOverview , tutorial/BuildingUpCalculationsOverview , and > tutorial/ListsOverview (these should be typed into the address bar of > the doc centre). After you've finished with these, you can jump around > randomly in the tutorials of the "Core Language" section, and see what > Mathematica can do. > > > Table[stat[i], {i, 1, 10}]; > > For[i = 1, i <= 10, (stat[i] = Array[0 &, {10, 2}]); i++]; > > > > Then I try > > stat[1] > > which yields > > {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, > {0, 0}, > > {0, 0}} > > It is not very clear from these two lines what you are trying to do. Do > create a 10x2 array, use e.g. Table[x^2 + y^2, {x, 0, 1}, {y, 0, 9}] > > Lists are indexed with [[ ]]. > > And as a newbie, avoid *For* like the plague! In 99.5% of the cases, > there is a better way than using For. > > > This seems okay. However, I don't know how to endow values to it, for > > instance change the first {0, 0} to {1,0}. > > > > -- > Szabolcs > >
- References:
- Re: How to construct a vector whose elements are also vectors?
- From: Szabolcs Horvát <szhorvat@gmail.com>
- Re: How to construct a vector whose elements are also vectors?