Function not returning a particular value

Viewed 43

I am modelling an equation with these parameters but when i try to call the function for xi = 0, the function does not return any value.

def zp(T, xi, sig, mu):
    p = 1/T
    yp = -log(1 - p)
    if xi == 0:
        zp = mu - sig*log(yp);
    else:
        zp = mu - (sig/xi)*(1-(yp**-xi));
        return(zp)

zp(5, 0, 6, 2)
1 Answers

Perhaps the return is indented incorrectly?

def zp(T, xi, sig, mu):
    p = 1 / T
    yp = -log(1 - p)

    if xi == 0:
        zp = mu - sig * log(yp)
    else:
        zp = mu - (sig / xi) * (1 - (yp ** -xi))

    return zp
Related