RE: selfdefined operators
- To: mathgroup at smc.vnet.net
- Subject: [mg23000] RE: [mg22989] selfdefined operators
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 10 Apr 2000 02:22:29 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Roland Koppenberger wrote: > I have defined the operator \[CirclePlus] in the following way: > > x_ \[CirclePlus] y_ := x y /(x + y) > > When type in > > 1 \[CirclePlus] 2 > > I get 2/3 as the right result. But when I try to compute > > 1 \[CirclePlus] 2 \[CirclePlus] 3 > > the result will not be computed. How can I specify the operator in a > general way? > Roland, Either use parentheses, since your function only accommodates 2 arguments: 1 \[CirclePlus] (2 \[CirclePlus] 3) or define CirclePlus this way to accommodate more than two arguments: CirclePlus[x_, y_] := x y/(x + y) CirclePlus[x_, y_, z__] := CirclePlus[CirclePlus[x, y], z] 1 \[CirclePlus] 2 \[CirclePlus] 3 6/11 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/