Run to view results
def cobb_douglas(A, K, L, alpha):
"""
Computes the level of output using a Cobb-Douglas production function.
Parameters:
A (float): Total factor productivity (TFP)
K (float): Capital input
L (float): Labor input
alpha (float): Capital's share of income (0 < alpha < 1)
Returns:
float: The output level (Y)
"""
# Ensure inputs are valid
if not (0 < alpha < 1):
raise ValueError("Alpha must be between 0 and 1.")
if K < 0 or L < 0:
raise ValueError("Capital and Labor inputs must be non-negative.")
# Compute the output
Y = A * (K**alpha) * (L**(1 - alpha))
return Y
Run to view results
import numpy as np
import matplotlib.pyplot as plt
# Cobb-Douglas production function (from Exercise 1)
def cobb_douglas(A, K, L, alpha):
"""
Computes the level of output using a Cobb-Douglas production function.
"""
if not (0 < alpha < 1):
raise ValueError("Alpha must be between 0 and 1.")
if K < 0 or L < 0:
raise ValueError("Capital and Labor inputs must be non-negative.")
return A * (K**alpha) * (L**(1 - alpha))
# Given parameters
A = 1.2 # Total factor productivity
L = 50 # Labor input
alpha = 0.3 # Capital's share of income
# Generate an array of K values
K_values = np.linspace(0, 5, 100) # 100 points between 0 and 5
# Compute output for each K
output_values = [cobb_douglas(A, K, L, alpha) for K in K_values]
# Plot the production function
plt.figure(figsize=(8, 6))
plt.plot(K_values, output_values, label=f'Production Function ($A={A}$, $L={L}$, $\\alpha={alpha}$)', color='blue')
plt.title('Cobb-Douglas Production Function')
plt.xlabel('Capital Input (K)')
plt.ylabel('Output (Y)')
plt.grid(True)
plt.legend()
plt.show()
Run to view results
import numpy as np
import matplotlib.pyplot as plt
# Cobb-Douglas production function
def cobb_douglas(A, K, L, alpha):
"""
Computes the level of output using a Cobb-Douglas production function.
"""
if not (0 < alpha < 1):
raise ValueError("Alpha must be between 0 and 1.")
if K < 0 or L < 0:
raise ValueError("Capital and Labor inputs must be non-negative.")
return A * (K**alpha) * (L**(1 - alpha))
# Parameters
L = 50 # Fixed labor input
alpha = 0.3 # Capital's share of income
K_values = np.linspace(0, 5, 100) # Range of K values
# Different values of A to compare
A_values = [1, 2, 4, 5]
# Plot the production function for each A
plt.figure(figsize=(10, 6))
for A in A_values:
output_values = [cobb_douglas(A, K, L, alpha) for K in K_values]
plt.plot(K_values, output_values, label=f'A = {A}')
# Customize the plot
plt.title('Effect of Increasing A on the Cobb-Douglas Production Function')
plt.xlabel('Capital Input (K)')
plt.ylabel('Output (Y)')
plt.grid(True)
plt.legend(title='Total Factor Productivity')
plt.show()
Run to view results
import numpy as np
import matplotlib.pyplot as plt
# Cobb-Douglas production function
def cobb_douglas(A, K, L, alpha):
"""
Computes the level of output using a Cobb-Douglas production function.
"""
if not (0 < alpha < 1):
raise ValueError("Alpha must be between 0 and 1.")
if K < 0 or L < 0:
raise ValueError("Capital and Labor inputs must be non-negative.")
return A * (K**alpha) * (L**(1 - alpha))
# Parameters
A = 1.2 # Fixed total factor productivity
alpha = 0.3 # Capital's share of income
K_values = np.linspace(0, 5, 100) # Range of K values
# Different values of L to compare
L_values = [1, 2, 4, 5]
# Plot the production function for each L
plt.figure(figsize=(10, 6))
for L in L_values:
output_values = [cobb_douglas(A, K, L, alpha) for K in K_values]
plt.plot(K_values, output_values, label=f'L = {L}')
# Customize the plot
plt.title('Effect of Increasing L on the Cobb-Douglas Production Function')
plt.xlabel('Capital Input (K)')
plt.ylabel('Output (Y)')
plt.grid(True)
plt.legend(title='Labor Input (L)')
plt.show()
Run to view results
import numpy as np
import matplotlib.pyplot as plt
# Cobb-Douglas production function
def cobb_douglas(A, K, L, alpha):
"""
Computes the level of output using a Cobb-Douglas production function.
"""
if not (0 < alpha < 1):
raise ValueError("Alpha must be between 0 and 1.")
if K < 0 or L < 0:
raise ValueError("Capital and Labor inputs must be non-negative.")
return A * (K**alpha) * (L**(1 - alpha))
# Parameters
A = 1.2 # Fixed total factor productivity
alpha = 0.3 # Capital's share of income
K_values = np.linspace(0, 5, 100) # Range of K values
# Different values of L to compare
L_values = [1, 2, 4, 5]
# Plot the production function for each L
plt.figure(figsize=(10, 6))
for L in L_values:
output_values = [cobb_douglas(A, K, L, alpha) for K in K_values]
plt.plot(K_values, output_values, label=f'L = {L}')
# Customize the plot
plt.title('Effect of Increasing L on the Cobb-Douglas Production Function')
plt.xlabel('Capital Input (K)')
plt.ylabel('Output (Y)')
plt.grid(True)
plt.legend(title='Labor Input (L)')
# Save the plot in different formats
plt.savefig('cobb_douglas_plot.png', format='png', dpi=300)
plt.savefig('cobb_douglas_plot.jpeg', format='jpeg', dpi=300)
plt.savefig('cobb_douglas_plot.pdf', format='pdf')
# Show the plot
plt.show()
Run to view results
from IPython.display import IFrame
# Define the URL of the website
url = "https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes"
# Display the website in an IFrame
IFrame(src=url, width=800, height=600)
Run to view results
from IPython.display import IFrame
# Define the URL for the patent application report
url = "https://databank.worldbank.org/reports.aspx?Report_Name=patent-application&Id=d484ab34"
# Display the IFrame with the specified webpage
IFrame(src=url, width=1000, height=800)
Run to view results