RE: Idempotence
- To: mathgroup at smc.vnet.net
- Subject: [mg37766] RE: [mg37748] Idempotence
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 12 Nov 2002 03:13:19 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Tilo, Expand and use a Rule... list1 = {b + a c - a b c, c, 1}; list2 = {2 b + 2 a c - a b c - a c (b + a c - a b c) - b (b + 2 a c - a b c - a c (b + a c - a b c)), c, 1}; list2 // Expand % /. Power[a_, n_Integer?Positive] -> a % == list1 gives {2*b - b^2 + 2*a*c - 4*a*b*c + 2*a*b^2*c - a^2*c^2 + 2*a^2*b*c^2 - a^2*b^2*c^2, c, 1} {b + a c - a b c, c, 1} True For more general use, you can convert the code to a routine. idempower[expr_] := Expand[expr] /. Power[a_, n_Integer?Positive] -> a idempower[list2] == list1 True David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Tilo Schröder [mailto:tilo.schroeder at unibw-muenchen.de] To: mathgroup at smc.vnet.net Hello, I'm quite new in operating with Mathematica. Solving a problem concerning network reliability I have to implement an algorithm which uses idempotence (e.g.: a*a=a, a^2*b^3=ab). As a result of this fact, the following lists should be the same: list1={b+a c-a b c,c,1} list2={2 b+2 a c-a b c-a c (b+a c-a b c)-b (b+2 a c-a b c-a c (b+a c-a b c)),c,1} The result of "list1===list2" should be true. Does anybody have a hint or an idea how to solve it with Mathematica? I couldn't find anything about it even on Wolfram's webpage. Thank you in advance. Tilo.