Defining a function

import math

def myfunc(y):
    if y >= 0.0:  
        return y**5*math.exp(-y)
    else:         
        return 0.0


# alternative way of calling module functions
# (gives more math-like syntax in this example):

from math import *
def myfunc(y):
    if y >= 0.0:  
        return y**5*exp(-y)
    else:         
        return 0.0

previousnexttable of contents