Change multiplication operations into convolution operations (result & follow up question)
- To: mathgroup at smc.vnet.net
- Subject: [mg73751] Change multiplication operations into convolution operations (result & follow up question)
- From: "Zhao, Liang" <ZhaoL at MedImmune.com>
- Date: Tue, 27 Feb 2007 05:51:03 -0500 (EST)
- References: <erjp4f$pt3$1@smc.vnet.net> <200702230928.EAA17242@smc.vnet.net>
Hi Jens and all, Following up my previously posted question, I finally got a temporary solution for my previous question to change multiplication operations into convolution operations in a expression like below. Thank four experts for their brilliant hints to approach to this problem. However, the following code only work for functions like fi[t] that is with explicit expressions. expr=a f3[t] f1[t] f2[t]; expr=expr/.Times=AEconv; ((expr//.conv[c_/;FreeQ[c,t],r__]=AEc*conv[r])//.conv[any___,a_[t_],b_[t_ ]]=A6(var=Unique[t];conv[any,function[Integrate[a[#-var]*b[var],{var,0,= #}]][t]]))/.conv[a_]=A6a/.function=AEFunction The output is exactly what I am expecting. My question: under circumstances that fi[t] assumes numerical functions in InterpolatingFunction format, how to make the above codes to work equivalently. E.g., sol=NDSolve[{x'[t]S-y[t]-x[t]^2,y'[t]S2 = x[t]-y[t],x[0]Sy[0]S1},{x[t],y[t]},{t,100}]; f1[t_]: =sol[[1,1,2]] f2[t_] :=sol[[1,2,2]] f3[t_]: =2 sol[[1,1,2]] I tried to modify the codes accordingly via different ways, but failed. Thank you for any hints. Cheers, Liang Hi, expr = C1 F1[t] ** F2[t] + C2 F3[t] ** F4[t] ** F1[t] try (expr //. NonCommutativeMultiply[any___, a_[t_], b_[t_]] :> (var = Unique[t]; NonCommutativeMultiply[any, function[Integrate[ a[# - var]*b[var], var]][t]])) /. NonCommutativeMultiply[a_] :> a /. function -> Function Regards Jens Zhao, Liang wrote: > If I want to change the multiplication operations into convolution > operations in an arbitrary function such as > C1 F1[t] F2[t] + C2 F3[t] F4[t] F1[t], > where Fi(t) represents functions of t and Ci represents constant, into > C1 F1[t] * F2[t] + C2 F3[t] * F4[t] * F1[t], where "*" indicate > convolution. > > any good elegant way to do it? High appreciations! > > Liang > > >
- References:
- Re: Change multiplication operations into convolution operations
- From: Jens-Peer Kuska <kuska@informatik.uni-leipzig.de>
- Re: Change multiplication operations into convolution operations