Here’s a simple function Xpee. I want a rule that combines “Xpee[aa] (+/-) Xpee[-aa]” to give ZipIt[aa]. For example Xpee[-1/5] - Xpee[1/5] yields ZipIt[1/5]. I’ve used MatchQ to test various parts of the rule. I can MatchQ parts such as Xpee[aa_]. But I’ve failed with various combination rules such as
XpRule:= Xpee[aa\_] - Xpee[-aa\_] -> ZipIt[aa]
And I’ve used FullForm to get to this point but I can’t quite get to the point of a workable rule to combine -Xpee[-aa] + Xpee[aa] to give ZipIt[aa]. The Times gets in the way. What am I missing to come up with a workable rule to combine Xpee[aa] (+/-) Xpee[-aa]?
I appreciate the help. Thank you. The rule works great. I tried something like your rule above but I was stumped because I didn’t understand the difference between ‘=’ and ‘==’ or really where to place the condition. Again thank you for your help.
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: