Question: Pb calling a composition of functions twice : type confusion ??

Hi everybody,

I'm not really sure of where sould I post my question.

Let me explain my problem :

I've got a convolution product of my function f and my filter called G (let say a gaussian for example, or a top hat filter). It is as follows :

filtre:=proc(g);
return x->(1/(2*Delta)*int(g(t),t=(x-Delta)..(x+Delta)));
end;

filtre:=proc(g) local a,G;
G:=x->sqrt(gamma/(Pi*Delta^2))*exp(-gamma*x^2/(Delta^2));
return x->int(g(t)*G(x-t),t=-infinity..infinity);
end;

For any of these 2 examples, I can calculate the convolution of my kernel "G" with any function f by :

filtre(f);

Taking for example the heaviside function, I have :

plot([filtre(Heaviside)(x)],x=-10..10);

which gives me the correct result, but if I try to call this function twice, the result given is a constant, and it's not what is expected. I think there is a confusion of type, but I can't find it.

I tried other functions : Dirac, and defining a gaussian :

Delta:=3;
g:=x->sqrt(gamma/(Pi*Delta^2))*exp(-gamma*x^2/(Delta^2));
gb:=filtre(g);
gbb:=filtre(gb);
plot([g(x), gb(x),gbb(x)],x=-10..10);

But I still have the same mistake, as if "gb" wasn't considered as a function but as a constant.

 

Can anyone help me please?
Or tell me if I'm not under the right topic to find any help?

Thanks!

zguywood

Please Wait...