MathGroup Archive 2001

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

Search the Archive

Re: Factorising operators??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30977] Re: [mg30959] Factorising operators??
  • From: BobHanlon at aol.com
  • Date: Sat, 29 Sep 2001 04:18:56 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2001/9/28 5:22:20 AM, m.k.bowen at lboro.ac.uk writes:

>I have two operators, a and b, that function as approximations to first
>and
>second order derivatives. I can write (a+b)[x] and then use Through[%,Plus]
>to generate a[x]+b[x] but I want to do the reverse, ie. Get mathematica
>to
>output (a+b)[x] if I give it a[x]+b[x]. Is there any way (preferably simple)
>to do this which will also work with more general cases ie. a[x]+5b[x]+const
>c[x] should produce (a+5b+const)[x]
>

ClearAll[a,b,c,d,x];

c[x_] := c;

undoThrough[expr_, var_:x] := (expr /. f_[var] :> f)[var];

expr1 = (a+5b+c)[x]

(a + 5*b + c)[x]

expr2 = Through[expr1] /. (c_?NumericQ*f_)[x_] :> c*f[x]

c + a[x] + 5*b[x]

undoThrough[expr2]

(a + 5*b + c)[x]


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Equation solving and Regress
  • Next by Date: Mathematica for Statistics?
  • Previous by thread: Re: Factorising operators??
  • Next by thread: Re: Factorising operators??