Re: Converting list of subscripted variables into an array
- To: mathgroup at smc.vnet.net
- Subject: [mg118325] Re: Converting list of subscripted variables into an array
- From: Alexei Boulbitch <alexei.boulbitch at iee.lu>
- Date: Fri, 22 Apr 2011 05:40:27 -0400 (EDT)
Chris, what about the following: 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}; Clear[u]; Do[u[1, j] = Subscript[c1, j], {j, 1, 5}] u[1, 5] {2.46875, 1.67188} ?? I write u[i,j] instead of C[i,j], since C is protected. Or you may make a table out of it and simultaneously the array: tab = Table[u[1, j] = Subscript[c1, j], {j, 1, 5}] {{1.79688, 1.34375}, {2.15625, 1.34375}, {2.29688, 1.35938}, {2.375, 1.46875}, {2.46875, 1.67188}} u[1, 1] {1.79688, 1.34375} Have fun. Alexei 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 -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu www.iee.lu -- This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.