# Change multiplication operations into convolution operations

Discussion in 'Mathematica' started by Zhao, Liang, Feb 22, 2007.

1. ### Zhao, LiangGuest

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

Zhao, Liang, Feb 22, 2007

2. ### dhGuest

Hi Liang,

you coul e.g. try:

C1 F1[t] F2[t] + C2 F3[t] F4[t] F1[t] //. Times[c___, a_[t_], d___,

b_[t_], e___] -> c d e a[t] \[Star] b[t]

Daniel

dh, Feb 23, 2007

3. ### Jens-Peer KuskaGuest

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

Jens-Peer Kuska, Feb 23, 2007
4. ### Jean-Marc GullietGuest

In:=
expr = C1*F1[t]*Z6*F2[t]*A1 + C2*F3[t]*F4[t]*F1[t]
expr /. Times -> conv //.
conv[c_ /; FreeQ[c, t], r__] -> c*conv[r]

Out=
A1*C1*Z6*F1[t]*F2[t] + C2*F1[t]*F3[t]*F4[t]

Out=
A1*C1*Z6*conv[F1[t], F2[t]] +
C2*conv[F1[t], F3[t], F4[t]]

Say that we have an expression called "expr" that consists of the sum of
products (denoted by *, Mathematica usual symbol for multiplication) of
functions in t by constant coefficients (that is, they are independent
of the variable t).

We want an expression that is the sum of products of the convolution
(denoted by the symbol "conv") of the functions in t by the constant
coefficients.

To do so, we first apply a transformation rule that converts any product
into a convolution, then we apply repeatedly a second transformation
rule that extract the constant coefficient from the convolutions and
multiply the latter by the former.

Regards,
Jean-Marc

Jean-Marc Gulliet, Feb 23, 2007
5. ### Zhao, LiangGuest

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],xSyS1},{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, Feb 27, 2007