Converting list of subscripted variables into an array
- To: mathgroup at smc.vnet.net
 - Subject: [mg118283] Converting list of subscripted variables into an array
 - From: "Christopher O. Young" <cy56 at comcast.net>
 - Date: Wed, 20 Apr 2011 04:27:29 -0400 (EDT)
 
I have a long list that's supposed to represent points on 9 different
curves. I'd like to put them into an array C[j,k] where j is the index for
the curves and k is the index for the points.
Subscript[c1, 1] = {1.796875, 1.34375}
Subscript[c1, 2] = {2.15625, 1.34375}
Subscript[c1, 3] = {2.296875, 1.359375}
Subscript[c1, 4] = {2.375, 1.46875}
Subscript[c1, 5] = {2.46875, 1.671875}
......
I'm new at pattern matching, and I'm having a hard time getting started
here. Can anyone steer me in the right direction?
Chris Young
cy56 at comcast.net
IntuMath.org
In[180]:= "c" <> IntegerString[1]
Out[180]= "c1"
In[181]:= Subscript["c" <> IntegerString[1], 2]
Out[181]= Subscript["c1", 2]
In[182]:= Evaluate[%]
In[183]:= Subscript["c1", 2]
Out[183]= Subscript["c1", 2]
ToExpression[Subscript["c1", 2]]
During evaluation of In[187]:= ToExpression::notstrbox: Subscript[c1, 2] is
not a string or a box. ToExpression can only interpret strings or boxes as
Mathematica input. >>
Out[187]= $Failed
In[188]:= ToExpression[RowBox[{Subscript["c1", 2]}]]
During evaluation of In[188]:= ToExpression::esntx: Could not parse
RowBox[{Subscript[c1, 2]}] as Mathematica input. >>
Out[188]= $Failed