MathGroup Archive 2006

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

Search the Archive

Re: Question regarding replacement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63866] Re: [mg63860] Question regarding replacement
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 20 Jan 2006 04:32:20 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

a=b c/d;

params={d/(b c)->theta};

Since you require that params not be redefined and, presumably, that params 
be used:

a/.Solve[params/.Rule->Equal,b][[1]]

1/theta

or

a/.Solve[params/.Rule->Equal,c][[1]]

1/theta

or

a/.Solve[params/.Rule->Equal,d][[1]]

1/theta

In general, the LHS of a replacement rule should be as simple as possible so 
that the form will match.


Bob Hanlon

> 
> From: "michael_chang86 at hotmail.com" <michael_chang86 at hotmail.com>
To: mathgroup at smc.vnet.net
> Subject: [mg63866] [mg63860] Question regarding replacement
> 
> Hi,
> 
> Often, when manipulating symbolic results, one might want to replace
> some symbols with "simpler" expressions, and typically, I've managed
> this with "/.".  However, suppose that
> 
> In[1]:  a = b c/d
> 
> and I know that d/(b c) = theta.  Unfortunately,
> 
> In[2]:  params={d/(b c)->theta}; a/.params
> does *not* yield 1/theta.  How can I achieve this simply *without*
> redefining params?
> 
> (This (too) simple example is meant to demonstrate some difficulties
> that I typically encounter when trying to replace symbols in *much*
> more complicated expressions, where, sometimes, the symbols that I am
> trying to replace are inverted ... :(  )
> 
> My apologies in advance, since this seems embarassingly simple, but any
> help or suggestions would be greatly appreciated!
> 
> Regards,
> 
> Michael
> 
> 

Bob Hanlon
Chantilly, VA


  • Prev by Date: A quick question regarding expectation rules
  • Next by Date: Re: Question regarding replacement
  • Previous by thread: Re: Question regarding replacement
  • Next by thread: Re: Question regarding replacement