stevecondylios / priceR

Economics and Pricing in R
https://stevecondylios.github.io/priceR/
Other
59 stars 7 forks source link

Functional to accept demand curve and cost function, return π max #14

Open stevecondylios opened 4 years ago

stevecondylios commented 4 years ago

A simple functional to accept a demand curve function, cost function, and return π max.

Experiment with including parameters for some 'degree' of π max (e.g. 30%, 60%, 90%) etc.

stevecondylios commented 4 years ago

Here's a simple example (in this example, we assume a constant cost function):

profit (π) qp - qc = q(p - c) ..........................................................................(1)

demand q = 200 - 20p ...................................................................................(2)

(2) into (1)

(200 - 20p)(p - c) = 200p - 200c - 20p^2 + 20pc ........................................................(3)

This gives profit for any given price

To find the price that maximises profit, take partial derivative w.r.t price:

 ∂π/∂p = 200 - 40p + 20c ...............................................................................(4)

We must provide the cost function, in this case we assume a constant cost function:

c = $4 .................................................................................................(5)

(5) into (4)

∂π/∂p = 200 - 40p + 80 = -40p + 280 ....................................................................(6)

Set to zero to optimise

-40p + 280 = 0

p = $7

Which is the profit maximising price for a given demand curve/equation and unit cost

Function should return pmax price, as well as π