Re: How to define an auto-Collect function (fwd)
- To: mathgroup at smc.vnet.net
- Subject: [mg7750] Re: How to define an auto-Collect function (fwd)
- From: "C. Woll" <carlw at u.washington.edu>
- Date: Mon, 7 Jul 1997 04:41:21 -0400
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 3 Jul 1997, Roland Franzius wrote: > just define > prd/: prd[a_,b_]+prd[a_,c]:=prd[a,b+c] > Your example takes 1.9 s on my old 486dx2/66 > r.franzius > Hi Roland, Thanks for the input on my question. Unfortunately, I think you might have made a mistake. First, there is no difference between the statements prd /: prd[a_,b_]+prd[a_,c_]:=prd[a,b+c] and prd[a_,b_]+prd[a_,c_]^:=prd[a,b+c] Try out both statements and check ??prd. Secondly, I think you might have missed the underscore after the c in the second prd. Without the underscore, the collecting function won't work, and my example will not work. As a test of your definition, make sure that prd[x,y]+prd[x,z] returns prd[x,y+z] Note that without the underscore, my example will run much faster, since there is less generality in the prd definition. Again, thanks for your suggestion. Carl Woll