Ask Your Question

Thisisnotanid's profile - activity

2014-06-29 21:33:07 +0200 received badge  Popular Question (source)
2014-06-29 21:33:07 +0200 received badge  Notable Question (source)
2014-06-29 21:33:07 +0200 received badge  Famous Question (source)
2013-07-14 20:00:09 +0200 received badge  Student (source)
2013-04-13 18:32:32 +0200 received badge  Editor (source)
2013-04-13 18:31:30 +0200 asked a question Convolving two functions doesn't work as expected

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?