MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg109177] Re: Through[(a+b+b)[x]]
  • From: "David Park" <djmpark at>
  • Date: Fri, 16 Apr 2010 05:49:28 -0400 (EDT)

The Presentations package has the PushOnto command that gives a more
controlled way to push arguments onto functions. You can specify the
patterns to push the arguments onto.


(a + 2 b)[x]; 
% // PushOnto[a, b] 
a[x] + 2 b[x]

(3 a - c Derivative[1][b])[x]; 
% // PushOnto[a, Derivative[1][b]] 
3 a[x]-c b'[x] 

afunc := #^2 &; 
bfunc = #^3 &; 
(afunc - 3 E^bfunc)[x]; 
% // PushOnto[_Function] 
-3 E^x^3 + x^2

Other useful functions in the Manipulations section of Presentations are
CompleteTheSquare, FactorOut, AddZero, MultiplyByOne, LinearBreakout,
MapLevelParts, MapLevelPatterns, EvaluateAt, EvaluateAtPattern.

David Park
djmpark at  

From: Derek Yates [mailto:yatesd at] 

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.

  • Prev by Date: How to simplify "Integrate[2 f[x], {x, 0, 1}]/2" to "Integrate[f[x],
  • Next by Date: LocatorAutoCreate in 2-parameter Manipulate?
  • Previous by thread: Re: Through[(a+b+b)[x]]
  • Next by thread: Re: Through[(a+b+b)[x]]