In an island's input-output table, making one dollar of industry j's output uses up A_{ij} dollars of industry i's output (column j is industry j's recipe). If final demand is d, total output x must satisfy x = Ax + d, so
where I is the identity matrix and L = (I - A)^{-1} is the Leontief inverse. Column j of L is the output every industry must produce, directly and through the whole chain of suppliers, to deliver one extra dollar of industry j's product to a final buyer. Two summaries of that column:
- the output multiplier of industry
j: the column sum \sum_i L_{ij}, total dollars of output across all industries; - the job multiplier of industry
j: \sum_i \ell_i L_{ij}, where \ell_i is the number of jobs industryineeds per thousand dollars of its output; this counts the jobs behind a thousand-dollar order for industryj.
Write multipliers(A, jobs) that returns a tuple (output, employment) of two lists, one entry per industry. Every column of A sums to less than 1, which guarantees that I - A can be inverted and that L has no negative entries. Plain Python only: no numpy.
Examples
Input: A = [[0.2, 0.1], [0.4, 0.3]], jobs = [8, 2]
Output: ([2.11538462, 1.73076923], [12.30769231, 4.61538462])
Explanation: L = [[1.3462, 0.1923], [0.7692, 1.5385]]. A dollar of farm produce for
households needs 1.35 dollars from the farms and 0.77 from the power plant: 2.12 in
all, and 8 * 1.3462 + 2 * 0.7692 = 12.3 jobs per thousand dollars.
Input: A = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], jobs = [1, 2, 3]
Output: ([1.0, 1.0, 1.0], [1.0, 2.0, 3.0])
Explanation: industries that buy nothing from each other have no ripple effect.
Constraints
- answers are compared with a relative tolerance of
1e-6; do not round
Goals
- Compute the Leontief inverse $(I - A)^{-1}$ by Gauss-Jordan elimination written out by hand
- Read its column sums as output multipliers: the total output behind one dollar of final demand
- Weight its columns by labour per dollar to get the jobs behind an order