← 返回题库
中级

完备市场均衡

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve(____):
    n_states = len(____)
    total_endowment = [sum(____) for i in range(____)]
    beta, gamma = utility_params
    state_prices = [p * (total_endowment[i] / sum(____)) ** (____) for i, p in enumerate(____)]
    consumption = []
    for e in endowments:
        wealth = sum(sp * e[i] for i, sp in enumerate(____))
        c = [wealth / sum(____) / n_states for _ in range(____)]
        consumption.append([round(____) for ci in c])
    return {"____": [round(____) for sp in state_prices], "____": consumption}

示例

输入
solve(["好", "坏"], [0.5, 0.5], [[100, 50], [50, 100]], [0.95, 2])
期望输出
{'状态价格': [0.25, 0.25], '均衡消费': [[75.0, 75.0], [75.0, 75.0]]}
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码