1

I have looked here which describes how to define operators. I was wondering whether there was a way to assign thes operators to special characters? eg Let $\odot:=(a+b)(ab),$ so 4\[CircleDot]3 would yield 84? It is really a stylistic / display issue - of course the same could be achieved with cd[a_,b_]:=(a+b) a b, implemented with cd[a,b].

martin
  • 8,678
  • 4
  • 23
  • 70

1 Answers1

4
CircleDot[a_, b_] := (a + b) a b

Now

4⊙3 
84
Karsten7
  • 27,448
  • 5
  • 73
  • 134
  • ha! I didn't think it would be that simple - I thought the operator would have to preceed the arguments - thank you! :) – martin Jun 19 '15 at 12:47
  • 3
    @martin 4⊙3//FullForm may shed some light on your confusion. Some operators are infix, meaning is the same as ~CircleDot~ and we know, that a~CircleDot~b is the same as CircleDot[a,b]. But in fact, you could just as easily set like so: a_⊙b_:=(a + b) a b, MMA would interpret this just like the full form that Karsten showed in this answer. – LLlAMnYP Jun 19 '15 at 13:06
  • @LLlAMnYP ah, I see - much like ~Join~ – martin Jun 19 '15 at 13:07
  • 1
    @martin precisely. When in doubt, always check the FullForm :) – LLlAMnYP Jun 19 '15 at 13:08