The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: [mg6092] Re: [mg6072] creating variables
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Robert Pratt

Posts: 56
Registered: 12/7/04
[mg6092] Re: [mg6072] creating variables
Posted: Feb 22, 1997 11:51 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Don't use double brackets.

In[1]:= Table[a[i],{i,1,2}]

Out[1]= {a[1], a[2]}

Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill
CB# 3250, 331 Phillips Hall
Chapel Hill, NC 27599-3250

On Tue, 18 Feb 1997, Alex Tabarrok wrote:

> I would like to create a list of variables a1,a2,a3 and so forth. The
> natural approach would seem to be:
> Table[a[[i]], {i, 1, 2}]
> but then I get the following "errors"
> Part::partd:
> Part specification a[[1]]
> is longer than depth of object.
> Part specification a[[2]]
> is longer than depth of object.
> Although the final answer is what I want.
> {a[[1]], a[[2]]}
> I could of course turn the error off but perhaps there is another
> more elegant (?) way of handling this issue. Thanks for your input.
> Alex
> Alex Tabarrok
> Department of Economics
> Ball State University
> EMail:

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.