Ask Your Question

Revision history [back]

One easy way is to use the Piecewise function. Some examples are given in the reference manual.

One easy way Will the following suit your needs?

def f(x,a):
    if x <= a:
        return 0
    else:
        return (x-a)^2

There is to use the also a Piecewise function. Some examples are given in the reference manual.class, but it doesn't look like it will work for what you want.