Convolving two functions doesn't work as expected

asked 2013-04-13 18:31:30 +0100

Thisisnotanid gravatar image

updated 2013-04-13 18:33:20 +0100

Hi all, I'm trying to convolve two functions as follows:

forget()
x = PolynomialRing(QQ, 'x').gen()
f1 = Piecewise([[(-1, 1), 1*x^0]])
f2 = Piecewise([[(0, 1), x], [(1, 2), -x + 2]])
g = f2.convolution(f1)
Q = g.plot(rgbcolor=(1,1,0), figsize = 4);
g

I get that g is given by:

Piecewise defined function with 4 parts, [[(-1, 0), 1/2*x^2 + x +1/2], [(0, 1), -1/2*x^2 + 3*x], [(1, 2), -1/2*x^2 - x + 4], [(2, 3), 1/2*x^2 - 3*x + 9/2]].

Whereas, if computed manually, g is given by:

Piecewise defined function with 3 parts, [[(-1, 0), 0.5*x^2 + x + 0.5], [(0, 2), -0.5*x^2 + x + 0.5], [(2, 3), 0.5*x^2 - 3*x + 4.5]

Why doesn't the one computed by sage match the correct function?

edit retag flag offensive close merge delete

Comments

Are the examples given in the documentation even right? E.g., see last example of "f1.convolution?". How/why are 5 parts given as the convolution when one function is 1 part and the other 2 parts?

rickhg12hs gravatar imagerickhg12hs ( 2013-04-15 18:44:38 +0100 )edit