Through[(a+b+b)[x]]
- To: mathgroup at smc.vnet.net
- Subject: [mg109166] Through[(a+b+b)[x]]
- From: Derek Yates <yatesd at mac.com>
- Date: Wed, 14 Apr 2010 23:13:14 -0400 (EDT)
Through[(a+b)[x]] yields a[x]+b[x] as expected, but Through[(a+b+b) [x]] yields a[x]+(2b)[x]. Through[(2b)[x]] yields 2[x]b[x]. Now, I can obviously get around this in this specific case, but generically is there a way to solve this so that Through[(a+b+b)[x]] yields a[x] +2b[x]? The case where I envisage this happening is when a sum of functions is supplied (say, for a given value of y, Through[(f[y]+g[y] +h[y]+j[y])[x]] and for some values of y, g = h. Then one will end up with the problem above. Other than some post processing using pattern matching, which feels a bit clunky, I can't think of a way around this.