Re: Question regarding replacement
- To: mathgroup at smc.vnet.net
- Subject: [mg63865] Re: [mg63860] Question regarding replacement
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Fri, 20 Jan 2006 04:32:19 -0500 (EST)
- References: <200601190503.AAA21333@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 19 Jan 2006, at 06:03, michael_chang86 at hotmail.com wrote: > 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 > There is actually in Mathematica an obsolete and no longer documented function that makes this sort of thing very easy: b*(c/d) /. AlgebraicRules[{d/(b*c) == theta}, {d, b, c}] 1/theta AlgebraicRules has been deprecated because the other functionality for manipulating algebraic expressions is more powerful and reliable, but unfortunately it is also harder to use. I can see two ways to do this, both not entirely obvious. One is using GroebnerBasis: GroebnerBasis[{a - b*(c/d), d/(b*c) - theta}, {theta}, {b, c, d}] {a*theta - 1} effectively this is saying a*theta == 1 so a == 1/theta. The other way is by using PolynomialReduce: Last[PolynomialReduce[b*(c/d), {d - theta*b*c}, {b, c, d}]] 1/theta To sue these methods effectively unfortunately requires some understanding of what GroebnerBasis and PolynomialReduce do, which actually is non trivial. I still think that it would be a good idea to bring back to life ALgebraicRUles (deprecated in version 3, I think), whose syntax is at least much more understandable by users without much knowledge of modern computational polynomial algebra. Andrzej Kozlowski
- References:
- Question regarding replacement
- From: "michael_chang86@hotmail.com" <michael_chang86@hotmail.com>
- Question regarding replacement