I am trying to set up rules as follows:
ClearAll[CircleTimes];
If the arguments are the same the output is zero:
CircleTimes[x_,x_]:=0;
If any of the arguments have Head
Plus
then distribute the function over the Plus
:
CircleTimes[x_,y_]/;MemberQ[{Head@x,Head@y},Plus]:=Distribute[CircleTimes[x,y],Plus];
or CircleTimes[x_Plus,y_]:=Distribute[CircleTimes[x,y],Plus];
If any of the arguments have Head
Times
then pull out the scalar coefficient:
CircleTimes[a_*x_,y_]:=a*CircleTimes[x,y];
If an argument switch is needed to apply the rules above then the sign should be reversed:
CircleTimes[x_,y_]:=-CircleTimes[y,x];
And following are the other terminating conditions:
CircleTimes[0,x_]:=0;
CircleTimes[OverHat[i],OverHat[j]]=OverHat[k];
CircleTimes[OverHat[j],OverHat[k]]=OverHat[i];
CircleTimes[OverHat[k],OverHat[i]]=OverHat[j];
What is the best and minimal way to implement this?