Open tpemartin opened 1 year ago
import numpy as np
def CESUtility(*alpha, rho):
def ces(*X):
X = np.array(X)
X = X.astype(float)
X = X.reshape(-1)
return sum(X ** (rho) * alpha)**(1/rho)
return ces
u = CESUtility(0.3, 0.3, 0.4, rho=2)
u(2, 4, 5)