[Date Index]
[Thread Index]
[Author Index]
Re: How to construct a vector whose elements are also vectors?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg82870] Re: How to construct a vector whose elements are also vectors?
*From*: Szabolcs Horvát <szhorvat at gmail.com>
*Date*: Thu, 1 Nov 2007 05:26:34 -0500 (EST)
*References*: <fg9peo$ms0$1@smc.vnet.net>
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
Prev by Date:
**Re: Simplifying polynomial and rounding problems**
Next by Date:
**Re: Which symbolic method for this Integral ?**
Previous by thread:
**Re: How to construct a vector whose elements are also vectors?**
Next by thread:
**Re: Re: How to construct a vector whose elements are also vectors?**
| |