1 | initial version |
This can be accomplished with the Heaviside step function, something that should be familiar in engineering (especially electrical engineering) contexts. Try sage: heaviside?
to see the docsting. I'll give a one variable example that you can easily turn into a two variable example for your application:
sage: g(x) = (1-heaviside(x-pi/2)) * heaviside(x + pi/2)
sage: plot(g(x), (x, -pi, pi))
sage: plot( g(x) * cos(x), (x, -pi, pi))