>
> What is wrong with this?
>
Thanks for replying.
Well, the indicator function I want should have f(1)=1, not f(1)=1/2.
It would be nice to be able to define the indicator function
correctly, but since I'm integrating that's not really a problem.
I can integrate the indicator functions just fine, but I need to
compute convolutions, which requires composing functions. I need to
compute the following:
Given f and g, I want (f*g)(x)=integral(f(x-y)g(y),y,-oo,oo) <-----
(convolution)
So, I need to compose f(x) with h(y)=x-y to get f(x-y).
But, the way I constructed the indicator function doesn't seem to be
compatible with composing functions. I get this error:
f1(x) = 1
f2(x) = 0
f = Piecewise([[(-oo,0),f2],[(0,1),f1],[(1,oo),f2]])
g = Piecewise([[(-oo,0),f2],[(0,1),f1],[(1,oo),f2]])
h(x) = f(x-y)g(y)
integral(f(x-y)g(y),y,-10,10
#Syntax Error:
integral(f(x-y)g(y),y,-10,10)
Another way I thought of doing that is to have the composition
redefine the set defining the indicator function. So if
f(x)=indicator([0,1]), then *as a function of y* f(x-
y)=indicator([-1+x,x]). But, I can't think of a clean way to do that.
I tried doing it manually, but I get an error:
g1(y) = 1
g2(y) = 0
f = Piecewise([[(-oo,0),g2],[(0,1),g1],[(1,oo),g2]])
g = Piecewise([[(-oo,-1+x),g2],[(-1+x,x),g1],[(x,oo),g2]])
integral(f*g,y,-10,10)
#Traceback (click to the left for traceback)
...
ValueError: Function not defined outside of domain.
I don't understand what that error means in the context of what I
tried to do.
Thanks
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org