How to multiply the number of votes in the R?

Asked

Viewed 42 times

0

This piece of code is inside a function I’m writing. In the last two lines is my problem.

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 and demand are Parts (useful to be able to differentiate them without problems), but apparently multiplying the Parts is not as simple as multiplying variables. Someone knows how to do it?

  • 2

    To be clearer, what result do you expect mg_cost1*demand?

  • 1

    The result of the multiplication of functions, nothing too sophisticated. An explicit numerical example would be if mg_cost1 is f(x)=2x and demand for g(x) = 2+x then mg_cost1*demand = 4x + 2x².

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.