ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 13 Apr 2013 18:31:30 +0200Convolving two functions doesn't work as expectedhttps://ask.sagemath.org/question/10019/convolving-two-functions-doesnt-work-as-expected/Hi all, I'm trying to convolve two functions as follows:
`forget()` <br>
`x = PolynomialRing(QQ, 'x').gen()` <br>
`f1 = Piecewise([[(-1, 1), 1*x^0]])` <br>
`f2 = Piecewise([[(0, 1), x], [(1, 2), -x + 2]])` <br>
`g = f2.convolution(f1)` <br>
`Q = g.plot(rgbcolor=(1,1,0), figsize = 4);` <br>
`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?
ThisisnotanidSat, 13 Apr 2013 18:31:30 +0200https://ask.sagemath.org/question/10019/