Ask Your Question

yideey's profile - activity

2024-02-09 10:30:13 +0200 received badge  Notable Question (source)
2024-02-09 10:30:13 +0200 received badge  Popular Question (source)
2013-07-14 20:03:38 +0200 received badge  Nice Question (source)
2011-12-06 22:23:05 +0200 commented question convolution got the wrong result

@kcrisman: Thanks for your help. And I am glad that we find the bug.

2011-12-06 11:02:25 +0200 received badge  Student (source)
2011-12-06 09:39:30 +0200 asked a question convolution got the wrong result

Hi, English is not my mother language, so I am trying to make myself clear. And sorry for my grammer mistakes.

I am new to sage and trying to do convolution:f(x) * g(x)?

f(x) = 2, -2 < x < 2; f(x) = 0, x < -2 or x > 2

g(x) = 3/4, 0 < x < 2; g(x) = 0, x < 0 or x > 2

I use the following code to do the job:

x = PolynomialRing(QQ,'x').gen()
f = Piecewise([[(-2, 2), 2 * x^0]])
show(f)
g = Piecewise([[(0, 2), 3/4 * x^0]])
show(g)
m = g.convolution(f)
show(m)

I think I am sure the result should be:

3/2 * x + 3, -2 < x < 0;

3, 0 < x < 2

-3/2 * x + 6, 2 < x < 4

0, x < -2 or x > 4

but it comes out that when 0 < x < 2, the result is 6, which should be 3. There must be something wrong, but I can not figure out. So I am here to ask for help.

Thank you.