[mg90410] Re: ReplaceAll

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown [mg90410] Re: ReplaceAll

by dh-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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@...>

Internet:<http://www.metrohm.com>



LightInTheBox - Buy quality products at wholesale price