# Mathematica:input subscript value

1. May 7, 2012

### shafieza_garl

Hi all,
i want to ask a very simple question.
the data i have is:
Code (Text):

Subscript[d, 1]=3;
Subscript[d, 2]=7;
Subscript[d, 3]=0.6;
Subscript[d, 4]=5;

is there any way i can put the value faster like subscript[d,i],{i,4}={3,7,0.6,5}.

2. May 8, 2012

### Bill Simpson

In[1]:= Table[(Subscript[d,i]={3,7,0.6,5}[]),{i,4}];Subscript[d,1]
Out[2]= 3

OR

In[3]:= i=1;Map[(Subscript[d,i++]=#)&,{3,7,0.6,5}];Subscript[d,2]
Out[5]= 7

OR

In[6]:= i=1;(Subscript[d,i++]=#)&/@{3,7,0.6,5};Subscript[d,3]
Out[8]= 0.6

Last edited: May 8, 2012
3. May 8, 2012

Thanks Bill.

4. May 8, 2012

### shafieza_garl

one more thing.if my eq.is like
Code (Text):

Subscript[d,1]=Subscript[e,1]/Subscript[f,1];
Subscript[d,2]=Subscript[e,2]/Subscript[f,2];
Subscript[d,3]=Subscript[e,3]/Subscript[f,3];

how is it possible to simplify like previous one.

5. May 8, 2012

### Bill Simpson

In[1]:= (Subscript[d,#]=Subscript[e,#]/Subscript[f,#])&/@{1,2,3};Subscript[d,1]

Out[1]= Subscript[e,1]/Subscript[f,1]

Just one caution. One of the top handful of reasons people post "this doesn't work, what do I do?" is because they think the just MUST use subscripts and cannot figure out why it isn't working. Search here or in the Wolfram Student forum for Subscript and count the number of posts that match this description.

Subscripts are not "ordinary variables with first class citizenship in Mathematica, despite how they look or how you think they might work." Without admitting that this has been a problem for decades, one of the Wolfram tech support people actually created a notebook to try to explain just a couple of the problems with this and how to try to get around them. Read the SubscriptedVariables101.nb here
http://forums.wolfram.com/student-support/topics/28271

In Mathematica subscripts are a tar pit of problems and inconsistencies. Now and then I find. or see that someone else has found, a wildly new way that subscripts do not work for a completely different reason.

Is it possible to make subscripts work? Sometimes. You have been warned. I hope it works out for you.