Question

In: Computer Science

Take the linear demand and functions for the market for beef: Demand: P=a1-b1Qd+cPc Supply: P=a2+b2Qd where...

Take the linear demand and functions for the market for beef:

Demand: P=a1-b1Qd+cPc

Supply: P=a2+b2Qd

where a1 and a2 are demand and supply intercepts, respectively. b1 and b2 are the slopes for demand and supply. Pc is the price of chicken, a substitute for beef. In this case, assume that both c and Pc are exogenously determined parameters.

1. In Python, create a function for the demand that inputs the prices and the parameters, and outputs the quantity demanded using the above function (Hint: You need to do some algebra to get Qd=…).

2. Create a function for supply, that inputs the prices and the parameters, and outputs the quantities supplied.

3. Using the parameters a1=80, a2=10, b1=.5, b2=2, c=.5, Pc=10, create graphs that show supply and demand. Be sure to put prices on the y-axis and quantities on the x-axis. Comment on what the graph shows for the approximate equilibrium price and quantity (hint: have prices go from 0 to 100, in increments of 10). Make sure your graphs have labels.

4. Now say the price of chicken rises from 10 to 20 and a new innovation in beef production causes supply to shift out, so that a2 = 5. Generate the new lists of quantities (use the same list of prices and give a new graph with old demand, old supply, new demand, and new supply). Be sure to give graph labels to make clear which line is which. Comment on the value of the new equilibrium.

5. Using pen and paper, solve for the equilibrium prices and quantities as functions of the parameters

6. Create a function that inputs the model parameters and outputs the equilibrium values for a given set of parameters.

7. Call the function to get the equilibrium for #3 and then call the function to get the equilibrium for #4. Comment on the differences. What happens to prices and quantities in equilibrium between the two and why?

Problem must be answered in Python

Solutions

Expert Solution

1).ANSWER:

GIVEN BELOW:

# For finding Demand Quantity

def demandQuantity(a1,b1,c,pc,Price):

Qd=(a1+c*pc-Price)/b1

return Qd

# function for finding Supply Quantity

def supplyQuantity(a2,b2, Price):

Qd=(a2-Price)/b2

return Qd

# Numpy librery is used to compute scientific calculation in python

# Here numpy is used for taking price in range 0 - 100 in increments of 10

# Here We increase the endinf poind in order to get perfect equilibirium point in graph

import numpy as np

price=np.arange(0,150,10).tolist()

print(price)

*for #3*

# Parameters for calculating demand and supply Quantity

a1=80

a2=10

b1=0.5

b2=2

c=0.5

pc=10

supplyQd=[] # These two lists will store supply and demand quantity

demandQd=[]

for i in price:

DQd=demandQuantity(a1,b1,c,pc,i)

demandQd.append(DQd)

SQd=supplyQuantity(a2,b2,i)

supplyQd.append(SQd)

# printing supply and demand quantity lists

print(demandQd)

print(supplyQd)

# Here, we used the matplotlib library for ploting graph

import matplotlib.pyplot as plt

plt.plot(demandQd,price,'-o') # Plot demand vs price

plt.plot(supplyQd,price,'-o',color='red') # Plot supply vs price

plt.legend(["Demand Quantity","Supply Quantity"],loc="upper right")

plt.xlabel("Quantity") # for labels

plt.ylabel("Price")

plt.show()

*for #4*

# parameters for Question no 4

a1=80

a2=5

b1=0.5

b2=2

c=0.5

pc=10

new_supplyQd=[]

new_demandQd=[]

for i in price:

new_demandQd.append(demandQuantity(a1,b1,c,pc,i))

new_supplyQd.append(supplyQuantity(a2,b2,i))

# here we printed a new list

print(new_demandQd)

print(new_supplyQd)

# Here, we used the matplotlib library for ploting graph

import matplotlib.pyplot as plt

plt.plot(demandQd,price,'-o') # old demand vs new price

plt.plot(supplyQd,price,'-o',color='red') #old suply vs price

plt.plot(new_demandQd,price,'-',color='green') #new demand vs price

plt.plot(new_supplyQd,price,'-') # new supply vs price

plt.legend(["Old Demand Quantity","New Supply Quantity", "New Demand Quantity", "New Supply Quantity"],loc="upper right") # legend

plt.xlabel("Quantity") # for labels

plt.ylabel("Price")

plt.show()

# Function for finfing Equilibirium price :

def findEquilibrumPoint(a1, a2, b1, b2, c ,pc):

price = (a1*b2 + c*pc*b2 - a2*b1)/(b2 - b1)

  

return price

print("Equilibirium Price for #3-------")

Equilibrium_price = findEquilibrumPoint(80, 10, 0.5, 2, 0.5, 10)

print(Equilibrium_price)

print("Equilibrium Price When the Demand Quantity met with Supply Quantity : "+str(Equilibrium_price))

print("\n")

print("Equilibirium Price for #4-------")

Equilibrium_price = findEquilibrumPoint(80, 5, 0.5, 2, 0.5, 10)

print(Equilibrium_price)

print("Equilibrium Price When the Demand Quantity met with Supply Quantity : "+str(Equilibrium_price))

OUTPUT :

GRAPH FOR #3....

GRAPF FOR #4....

EQUILIBRIUM POINTS

Equilibirium Price for #3------- 110.0

Equilibrium Price When the Demand Quantity met with Supply Quantity : 110.0

Equilibirium Price for #4------- 111.66666666666667

Equilibrium Price When the Demand Quantity met with Supply Quantity : 111.66666666666667

SCREENSHOT OF CODE AND OUTPUT :


Related Solutions

Assume the market for beef is described by the following demand and supply functions: Q(p) =...
Assume the market for beef is described by the following demand and supply functions: Q(p) = -6 + 6P…………………………………(1) Q(p) = 50 – 2P^2…………………………………(2) (a)Which of the two equations is the demand curve? How did you know? (b)Find the equilibrium price ($) and equilibrium quantity transacted (000 lb.)in this market. (c)Determine the price elasticity of demand at equilibrium for this product. (d)Suppose the adoption of a new technology allows this beef producer to increase supply by 4, how will this...
Assume the market for beef is described by the following demand and supply functions: Q(p) =...
Assume the market for beef is described by the following demand and supply functions: Q(p) = -6 + 6p ………………………………… Q(p) = 50 – 2P^2 ………………………………… (a)Which of the two equations is the demand curve? How did you know? (b)Find the equilibrium price ($) and equilibrium quantity transacted (000 lb.)in this market. (c)Determine the price elasticity of demand at equilibrium for this product. (d)Suppose the adoption of a new technology allows this beef producer to increase supply by 4, how...
Assume the market for beef is described by the following demand and supply functions: Q(p) =...
Assume the market for beef is described by the following demand and supply functions: Q(p) = -6 + 6P…………………………………(1) 2 Q(p) = 50 – 2P…………………………………(2) (a)Which of the two equations is the demand curve? How did you know? (b)Find the equilibrium price ($) and equilibrium quantity transacted (000 lb.)in this market. (c)Determine the price elasticity of demand at equilibrium for this product. (d)Suppose the adoption of a new technology allows this beef producer to increase supply by 4, how will...
P(A1) = 0.2, P(A2) = 0.25 A1 and A2 are independent Find P(A1C ∩ A2) Please...
P(A1) = 0.2, P(A2) = 0.25 A1 and A2 are independent Find P(A1C ∩ A2) Please add a venn diagram if possible Thanks in advance!
The prior probabilities for events A1 and A2 are P(A1) = 0.50 and P(A2) = 0.45....
The prior probabilities for events A1 and A2 are P(A1) = 0.50 and P(A2) = 0.45. It is also known that P(A1 ∩ A2) = 0. Suppose P(B | A1) = 0.20 and P(B | A2) = 0.05. If needed, round your answers to three decimal digits. (a) Are A1 and A2 mutually exclusive? - Select your answer -YesNoItem 1 Explain your answer. The input in the box below will not be graded, but may be reviewed and considered by...
Draw a graph showing the market demand and supply for beef and the demand for beef...
Draw a graph showing the market demand and supply for beef and the demand for beef produced by one beef farmer.  Make sure that you indicate the market price and the price received by the beef farmer.  Assume that the beef market is perfectly competitive.
Consider a market where demand is P = 10 - 2Q and supply is P =...
Consider a market where demand is P = 10 - 2Q and supply is P = Q/2. There is a consumption positive externality of $2.50/unit of consumption a. Calculate the market equilibrium. b. What is the social optimum quantity and price? c. If the government uses a tax to get producers to internalize their externality, what is the net price received by producers? d. Calculate the total surplus in the market equilibrium, at the social optimum and with the tax....
Consider a market where demand is P = 10 - 2Q and supply is P =...
Consider a market where demand is P = 10 - 2Q and supply is P = Q/2. There is a consumption positive externality of $2.50/unit of consumption a. Calculate the market equilibrium.    b. What is the social optimum quantity and price?    c. If the government uses a tax to get producers to internalize their externality, what is the net price received by producers?    d. Calculate the total surplus in the market equilibrium, at the social optimum and...
Find the consumer and producer surpluses by using the demand and supply functions, where p is...
Find the consumer and producer surpluses by using the demand and supply functions, where p is the price (in dollars) and x is the number of units (in millions). Demand Function Supply Function p = 1005 − 25x p = 42x consumer surplus $ producer surplus $
Consider a market where demand is given by P = 60 - ⅓ Qd and supply...
Consider a market where demand is given by P = 60 - ⅓ Qd and supply is given by P = 20 + ⅓ Qs. Consumer Surplus is ________ amd Producer Surplus is?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT