Re: Applying transformation rule to matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg9822] Re: [mg9720] Applying transformation rule to matrix
- From: Wouter Meeussen <vdmcc at vandemoortele.be>
- Date: Fri, 28 Nov 1997 05:35:36 -0500
- Sender: owner-wri-mathgroup at wolfram.com
hi Gary, try bigrule = Thread[Rule[Flatten at pos,Flatten at posval]] also look at the Book under "Dispach tables" if speed counts. wouter. At 12:06 25.11.97 -0500, you wrote: >I have a symbolic matrix created as > > pos=Array[p,{4,3}] > >and a corresponding matrix that stores actual values, e.g., > > posval={{1,2,3},{4,5,6},{7,8,9},{1,2,3}} > >I perform some operations on "pos" to get several other variables and >now I'd like to apply a transformation rule to see what the numerical >value of those resulting variables is with the values in "posval". >Assuming "var1" is some function of the elements in the matrix "pos", >is there an easier way to do this than: > > var1 /. {pos[[1,1]]->posval[[1,1]],...,pos[[4,3]]->posval[[4,3]]} > >The string of transformation rules in {}'s gets quite long for a 4x3 >matrix and it's a bit annoying having to cut and paste the thing >around. I don't want to assign pos=posval because I may define other >symbolic variables that are functions of "pos" later. > >Of importance may be that I'm using v2.2 on a Sparc under Solaris. > >I'm still learning Mathematica so be gentle if this is a dumb question! > >Thanks, >Gary > > NV Vandemoortele Coordination Center Oils & Fats Applied Research Prins Albertlaan 79 Postbus 40 B-8870 Izegem (Belgium) Tel: +/32/51/33 21 11 Fax: +/32/51/33 21 75 vdmcc at vandemoortele.be