First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 12 years ago

ndomes gravatar image

To distinct two cases you can use the heaviside function:

f(x) = heaviside(x)*x^2
print type(f)
f(2); f(0); f(-2)