RE: Patterns_ to define linear operators?
- To: mathgroup at smc.vnet.net
- Subject: [mg71410] RE: [mg71385] Patterns_ to define linear operators?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 17 Nov 2006 04:30:38 -0500 (EST)
Craig,
How about this?
breakoutFT[x_][expr_] :=
expr /.
FourierTransform[a__?(FreeQ[#, x] &)b_., x, k_] ->
a FourierTransform[b , x, k]
FourierTransform[a f[x], x, k]
% // breakoutFT[x]
FourierTransform[a f[x], x, k]
a*Sqrt[2*Pi]*DiracDelta[k]*f[x]
FourierTransform[a x f[x], x, k]
% // breakoutFT[x]
FourierTransform[a x f[x], x, k]
a*Sqrt[2*Pi]*x*DiracDelta[k]*f[x]
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: W. Craig Carter [mailto:ccarter at mit.edu]
Hello,
I'd like to implement a rule that will factor out constants from
linear operators such as FourierTransform; i.e.,
FourierTransform[a*f[x], x, k] to a*FourierTransform[f[x],x,k]
Here is a method that seems sensible at first, but is potentially
dangerous:
MyRule1 =
FourierTransform[a_ f_[y_], x_, k_] :-> a FourierTransform[f[y],x,k]
(which would fail if a was not free of x)
An improvement is:
MyRule2 =
FourierTransform[a_?(FreeQ[#,x]&), f_[y_], x_, k_] :-> a
FourierTransform[f[y],x,k]
(which would fail if a were a product, say b x)
Does anybody have advice on a robust way to implement this rule?
Thanks, Craig Carter