Re: Simplifying an expression in light of relationships between variables?
- To: mathgroup at smc.vnet.net
- Subject: [mg54283] Re: [mg54263] Simplifying an expression in light of relationships between variables?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 16 Feb 2005 14:36:02 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
cond={d==a+b,e==c+d}; Simplify[#,cond]& /@ {a+b,d-b,a+b+c,e-c,e-c-b} {d,d-b,e,d,d-b} FullSimplify[#,cond]& /@ {a+b,d-b,a+b+c,e-c,e-c-b} {d,d-b,e,d,d-b} For reasons unknown to me, d-b won't simplify. Hit it with a hammer. Simplify[#,cond] /. d-b:>a& /@ {a+b,d-b,a+b+c,e-c,e-c-b} {d,a,e,d,a} Bob Hanlon > > From: "Steve W. Brewer" <ste-ve at ka-tech.com> To: mathgroup at smc.vnet.net > Date: 2005/02/14 Mon PM 09:51:04 EST > To: mathgroup at smc.vnet.net > Subject: [mg54283] [mg54263] Simplifying an expression in light of relationships between variables? > > Suppose I have a few variables that are related in the following way: > > d == a + b > e == c + d > > > > I want Simplify and FullSimplify to consider these relationships when > performing simplification. For example: > > FullSimplify[a + b] > > d > > > > FullSimplify[d - b] > > a > > > > FullSimplify[a + b + c] > > e > > > > FullSimplify[e - c] > > d > > > > FullSimplify[e - c - b] > > a > > > > Is there a straightforward way to get this behavior? I've tried > experimenting with TransformationFunctions, but it looks like I need to > include every possible permutation for it to work, for example: > > TransformationFunctions -> > {Automatic, > # /. (d -> a + b)&, > # /. (a + b -> d)&, > # /. (a -> d - b)&, > # /. (d - b -> a)&, > # /. (b -> d - a)&, > # /. (d - a -> b)&, > ... } > > > > This is unwieldy even in this simple example, and it rapidly becomes > unmanageable as the number of variables and relationships increases. > > > Is there an easier way? > >