|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
大神,请指教!
代码的运行结果显示每次都是按参数的10%进行计算,但是我并没有看到设置中有10%的代码,麻烦帮忙看看,谢谢!代码如下:
import numpy as np
import matplotlib.pyplot as plt
# 已知信息
selling_price, variable_cost, fixed_cost, quantity = 10, 3, 70000, 30000
# 计算利润
def calculate_profit(price_change=0, cost_change=0, fixed_cost_change=0, quantity_change=0):
changes = np.array([price_change, cost_change, fixed_cost_change, quantity_change])
new_values = np.array([selling_price, variable_cost, fixed_cost, quantity]) * (1 + changes / 100)
return (new_values[0] - new_values[1]) * new_values[3] - new_values[2]
# 计算基础利润
base_profit = calculate_profit()
# 计算敏感系数
sensitivity_labels = ['单价', '单位变动成本', '固定成本', '销量']
sensitivity_results = [(calculate_profit(*[i == j for j in range(4)]) - base_profit) / base_profit * 100
for i in range(4)]
sensitivity_results |
|