Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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)