Naming pieces of patterns
- To: mathgroup at smc.vnet.net
- Subject: [mg29816] Naming pieces of patterns
- From: Cyril Fischer <fischerc at itam.cas.cz>
- Date: Thu, 12 Jul 2001 02:52:30 -0400 (EDT)
- Organization: Inst. of Theoretical and Applied Mechanics
- Sender: owner-wri-mathgroup at wolfram.com
How can I as simply as possible use "substitutions" 1. -(I/(2 a)) /. I/(2 a) -> A does not work, while (I/(2 a)) /. I/(2 a) -> A works well 2. {(a + b), -(a + b)}/. a + b -> e gives {e, -a - b} instead of {e,-e} 3. {-Sqrt[a + b], 1/Sqrt[a + b]} /. Sqrt[a + b] -> e gives {-e,1/Sqrt[a + b]} 4. {I, 2 I, -I} /. I -> J gives {J, 2 \[ImaginaryI], -\[ImaginaryI]} I know _why_ these cases do not work, but I would like to know, if there is a possibilty to use a common pattern rule to substitute all occurences of an expression. Thank you, Cyril Fischer