Re: Patterns_ to define linear operators?
- To: mathgroup at smc.vnet.net
- Subject: [mg71407] Re: Patterns_ to define linear operators?
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Fri, 17 Nov 2006 04:30:30 -0500 (EST)
- References: <ejgvpf$8tm$1@smc.vnet.net>
Something like? myruleoflin = FourierTransform[(a_.)*(f_), x_, s_] :> a*FourierTransform[f, x, s] /; FreeQ[a, x] FourierTransform[(a_.)*(f_), x_, s_] :> a*FourierTransform[f, x, s] /; FreeQ[a, x] FourierTransform[a*f[x], x, s] /. myruleoflin a*FourierTransform[f[x], x, s] FourierTransform[f[x], x, s] /. myruleoflin FourierTransform[f[x],x,s] FourierTransform[a x f[x], x, s] /. myruleoflin a FourierTransform[x f[x],x,s] Keep in mind that the rule is implemented in Mathematica. E.g. FourierTransform[a*(1/x)*Sin[x], x, s] (1/2)*a*Sqrt[Pi/2]*(Sign[1 - s] + Sign[1 + s]) Regards Dimitris W. Craig Carter wrote: > 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