samedi 27 octobre 2018

How to create functions in Python 3 defined on a closed domain?

How can I ensure the following function is undefined outside of the closed domain [0,L] using the 'else' function? I define the endpoints and the interval (0,L) using if-statements. My code is below:

def u(x):
    if x=0:
        return A
    elif x=L:
        return B
    elif 0<x<L:
        return 0*x+10
    else:

Aucun commentaire:

Enregistrer un commentaire