Rule parameter passing
- To: mathgroup at smc.vnet.net
- Subject: [mg34855] Rule parameter passing
- From: TerryH <tharter at attglobal.net>
- Date: Sun, 9 Jun 2002 05:10:37 -0400 (EDT)
- Reply-to: tharter at attglobal.net
- Sender: owner-wri-mathgroup at wolfram.com
Hi All: What is the best way in which to write a rule in which the rule's parameters may vary? I'm trying to do some symbolic replacements in various matrix expressions, in which sometimes the variables are say aA and Subscript[ \[Delta] , \[aA] ], and at other times the variables can be dD (say). I have been able to do this by applying succesive rules, as in matrix /. aA-> aA + Subscript[ \[Delta] , \[aA] ] /. x_Subscript-> fcn[ /[Delta], bB] /.aA-> bB where the function 'fcn' is: fcn[y_,sub_] := ysub However, I need to embed this code inside a Module, and have not been able to successfully pass variables into the successive transformation rules listed avove. Anybody got any ideas on how to do this efficiently? Is the onlty way to do this is to write a Package? Unfortunately, I have no experience in writing a package. Thanks in advance to all who may reply! ....Terry