Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Replacing an expression by an expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55646] Re: Replacing an expression by an expression
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 1 Apr 2005 05:36:17 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <d2g6d7$f7p$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <d2g6d7$f7p$1 at smc.vnet.net>, carlos at colorado.edu wrote:

> I have a 8 x 8 symbolic matrix B of complicated entries.
> Several partial expressions, however, can be simplified. Sample:
> 
> rep= {(J12*x14-J11*y14)*(J12*(x32+x43)-J11*(y32+y43)) -> A0*(A1-A0)};
> 
> The left expression appears verbatim in entry B[[1,1]], which is
> 
> -(L21*(J12*x14-J11*y14)*(J12*(-x32-x43)+J11*(y32+y43)))/
> (16*A412*J*(J11^2+J12^2))

It is _not_ verbatim.

> But when I say B=B/.rep, nothing happens. 

If you simplify B before applying the replacement rule it should work. 
For example,

  Simplify[-(L21*(J12*x14-J11*y14)*(J12*(-x32-x43)+J11*(y32+y43)))/
    (16*A412*J*(J11^2+J12^2))] /. rep

works fine.

More generally, since your expressions appear to only involve 
polynomials, PolynomialReduce is likely to be the best approach.

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Replacing an expression by an expression
  • Next by Date: Re: Why are the functions different?
  • Previous by thread: Re: Replacing an expression by an expression
  • Next by thread: Re: Replacing an expression by an expression