Re: Through[(a+b+b)[x]]

*To*: mathgroup at smc.vnet.net*Subject*: [mg109176] Re: Through[(a+b+b)[x]]*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Fri, 16 Apr 2010 05:49:17 -0400 (EDT)

On 15 Apr 2010, at 12:13, Derek Yates wrote: > 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. > The only way I can see of doing this without some post-processing is by using Unevaluated: Through[Unevaluated[(a + b + b)[x]]] a(x)+2 b(x) Andrzej Kozlowski