Redefining the minus operator

*To*: mathgroup at smc.vnet.net*Subject*: [mg52004] Redefining the minus operator*From*: Ben Kovitz <bkovitz at acm.org>*Date*: Sun, 7 Nov 2004 01:03:19 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Is there a way in Mathematica to redefine the minus sign to stand for a function of your choosing? For example, I'd like to be able to do something like this: In[1]:= Subtract[a_, b_] := MINUS[a, b] In[2]:= FullForm[x - y] Out[2]:= MINUS[x, y] In[3]:= 1 - 0 Out[3]:= MINUS[1, 0] What actually happens is: In[2]:= FullForm[x - y] Out[2]:= PLUS[x, Times[-1, y]] In[3]:= 1 - 0 Out[3]:= 1 Naturally, I'd also like to redefine the plus sign, too. When Plus[a_, b_] is redefined as PLUS[a,b], then x + y indeed evaluates as PLUS[x, y]. But Mathematica still simplifies if there are numbers in the expression: FullForm[1 + 0] comes out as 1. Ben Kovitz Humboldt State University