这段代码在我正在编写的函数中。我的问题出在最后两行。
cournot_2 = function(q0_1 = 0, c1 = 1, c1_2 = 0,
q0_2 = 0, c2 = 1, c2_2 = 0,
p_0, a = 1, b = 0) {
firm1 = quote(q0_1 + c1 * q1 + c1_2 * q1) ## firm 1's cost curve
firm2 = quote(q0_2 + c2 * q2 + c2_2 * q2) ## firm 2's cost curve
q = quote(q1 + q2) #total supply
demand = quote(p_0 + a*q + b * q^2) # market demand curve
mg_cost1 = D(firm1, "q1") #firm 1's marginal cost/ supply curve
mg_cost2 = D(firm2, "q2") # firm 2's marginal cost/ supply curve
profit1 = (mg_cost1*demand) - firm1 #each firm's profit curve
profit2 = (mg_cost2*demand) - firm2
mg_costi
和demand
是引号,但是显然不能简单地通过使用“ *”运算来乘引号,这在乘以变量时是合适的。那么,我该怎么办?