Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jbnsn committed May 3, 2022
1 parent ea768a6 commit 94e7a1b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
# =============================================================================

# Leontief inverse
L = np.linalg.inv(I - A)
L_linverse = np.linalg.inv(I - A)

# Total intensities
F_linverse = np.dot(f,L)
F_linverse = np.dot(f,L_linverse)

# Scale to final demand
E_linverse = np.multiply(F_linverse,y)
Expand Down Expand Up @@ -89,9 +89,13 @@
'Tenth production layer' : np.linalg.matrix_power(A,10),
}

# sum(L_decomposed.values()) is an approximation of L = np.linalg.inv(I - A)
# Multiplication with f returns F
F_series = np.dot(f,sum(L_decomposed.values()))
# sum(L_decomposed.values()) is approximately L = np.linalg.inv(I - A)

# Leontief inverse
L_series = sum(L_decomposed.values())

# Total intensities
F_series = np.dot(f,L_series)

# Scale to final demand
E_series = np.multiply(F_series,y)
Expand Down

0 comments on commit 94e7a1b

Please sign in to comment.