Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to construct a vector whose elements are also vectors?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82847] Re: How to construct a vector whose elements are also vectors?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 1 Nov 2007 05:14:39 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <fg9peo$ms0$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

the bad news first, you have *not* created a vector, you
have created a function stat[] and it would be difficult
to change the function values. You have mixed up the
function call stat[i] with the Part[] operation somearray[[i]].
You mean
stat=Table[0,{10},{2}]

and

stat[[1]] as you expect.
and
stat[[1,1]]=1

will assign a value to the first component of the first vector.

Regards
   Jens

Guofeng Zhang wrote:
> Hi, there,
>    I'd like to construct a vector whose elements are also vectors. I used
> the following conmands:
> 
> 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}}
> 
> This seems okay. However, I don't know how to endow values to it, for
> instance change the first {0, 0} to {1,0}.
> 
> Thank you for your time and help!
> Henry
> 
> 


  • Prev by Date: Re: What is the precedence wrt Mathematica infix operators
  • Next by Date: Re: What is the precedence wrt Mathematica infix operators
  • Previous by thread: Re: What is the precedence wrt Mathematica infix operators
  • Next by thread: Re: How to construct a vector whose elements are also vectors?