Re: ReplaceAll
- To: mathgroup at smc.vnet.net
- Subject: [mg90410] Re: ReplaceAll
- From: dh <dh at metrohm.ch>
- Date: Tue, 8 Jul 2008 07:48:35 -0400 (EDT)
- References: <g4v2u3$idv$1@smc.vnet.net>
Hi Bruce, note that M=b**a'+a**b' works as expected. Then look at: (-a ** bp) // FullForm and you see that ** binds stronger than Times. Therefore, a pattern that works for "-a" as well as "a" reads: Optional[c1_Integer]c2_** b'**b**c3_->c1 c2** x **c3 hope this helps, Daniel Bruce Colletti wrote: > Re Mathematica 6.0.2 under WinXP. > > Why doesn't the following substitute x for b'**b (appears in the third, fourth, sixth and seventh summands)? (a**b')**b/.b'**b->x does. > > Thankx. > > Bruce > > In[1]:= M=b**a'-a**b'; > Distribute[M**M**M,Plus]/.b'**b->x > > Out[2]= (-a**b^\[Prime])**(-a**b^\[Prime])**(-a**b^\[Prime])+b**a^\[Prime]**(-a**b^\[Prime])**(-a**b^\[Prime])+(-a**b^\[Prime])**b**a^\[Prime]**(-a**b^\[Prime])+(-a**b^\[Prime])**(-a**b^\[Prime])**b**a^\[Prime]+b**a^\[Prime]**b**a^\[Prime]**(-a**b^\[Prime])+b**a^\[Prime]**(-a**b^\[Prime])**b**a^\[Prime]+(-a**b^\[Prime])**b**a^\[Prime]**b**a^\[Prime]+b**a^\[Prime]**b**a^\[Prime]**b**a^\[Prime] > > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh at metrohm.com> Internet:<http://www.metrohm.com>