Hi Anthony,
I am just playing around: If you actually want your problem solved by a rule then Bills solution is perfect! My remark here is that the same can be accomplished by proper definition of your function Xpee
:
(* definition for symbolic arguments: *)
Xpee /: Xpee[a_] + Xpee[-a_] := Ziplt[a]
Xpee /: Xpee[a_] - Xpee[-a_] := Ziplt[a]
Xpee /: -Xpee[a_] + Xpee[-a_] := Ziplt[-a]
(* definition for numeric arguments: *)
Xpee /: Xpee[a_?Positive] + Xpee[b_?Negative] := Ziplt[a] /; a == -b
Xpee /: Xpee[a_?Positive] - Xpee[b_?Negative] := Ziplt[a] /; a == -b
Xpee /: -Xpee[a_?Positive] + Xpee[b_?Negative] := Ziplt[-a] /; a == -b
(This should be checked carefully!)
Note:
What I get here is e.g.:
Xpee[-2] - Xpee[2]
Out : Ziplt[-2]
which is in disagreement with Bills outcome! You write:
... a rule that combines "Xpee[aa] (+/-) Xpee[-aa]" to give ZipIt[aa]. For example Xpee[-1/5] - Xpee[1/5] yields ZipIt[1/5].
Isn't this a contradiction, i.e. shouldn't this give Xpee[-1/5] or -Xpee[1/5]?
Regards -- Henrik