Re: ReplaceRepeated in case of non ordered expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg108117] Re: [mg108070] ReplaceRepeated in case of non ordered expressions
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 8 Mar 2010 06:17:52 -0500 (EST)
- Reply-to: hanlonr at cox.net
eqns = {x == a + b, y == c + d, a == z + t, b == y};
x == (x //. Rule @@@ eqns)
x == c + d + t + z
This works for any ordering of the equations
Union[x == (x //. Rule @@@ #) & /@ Permutations[eqns]]
{x == c + d + t + z}
Bob Hanlon
---- Maria Davis <arbiadr at gmail.com> wrote:
=============
Hi;
I have such equations:
x=a+b
y=c+d
a=z+t
b=y
I want to use mathematica in order to simplify x and obtain: x=z+t+c
+d
I have used: [x,Listofequations]
This function is available if I have equations written in the
following order:
x=a+b
a=z+t
b=y
y=c+d
but in the case of non ordered equations, it doesn't work. Further, I
must use equations in the order given.
Please can you help me.
Thanks