Re: Applying transformation rule to matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg9828] Re: Applying transformation rule to matrix
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 28 Nov 1997 05:35:41 -0500
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Gary L. Hennigan wrote: > 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]]} One way to do this is to use Thread: var1 /. Thread[Flatten[pos] -> Flatten[posval]] Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________