quadsums

Filename: quadsums.py

Authors: Thomas Sargent, John Stachurski

This module provides functions to compute quadratic sums of the form described in the docstrings.

quantecon.quadsums.m_quadratic_sum(A, B, max_it=50)[source]

Computes the quadratic sum

\[V = \sum_{j=0}^{\infty} A^j B A^{j'}\]

V is computed by solving the corresponding discrete lyapunov equation using the doubling algorithm. See the documentation of util.solve_discrete_lyapunov for more information.

Parameters:

A : array_like(float, ndim=2)

An n x n matrix as described above. We assume in order for convergence that the eigenvalues of A have moduli bounded by unity

B : array_like(float, ndim=2)

An n x n matrix as described above. We assume in order for convergence that the eigenvalues of A have moduli bounded by unity

max_it : scalar(int), optional(default=50)

The maximum number of iterations

Returns:

gamma1: array_like(float, ndim=2)

Represents the value V

quantecon.quadsums.var_quadratic_sum(A, C, H, beta, x0)[source]

Computes the expected discounted quadratic sum

\[q(x_0) = E \sum_{t=0}^{\infty} \beta^t x_t' H x_t\]

Here {x_t} is the VAR process x_{t+1} = A x_t + C w_t with {w_t} standard normal and x_0 the initial condition.

Parameters:

A : array_like(float, ndim=2)

The matrix described above in description. Should be n x n

C : array_like(float, ndim=2)

The matrix described above in description. Should be n x n

H : array_like(float, ndim=2)

The matrix described above in description. Should be n x n

beta: scalar(float)

Should take a value in (0, 1)

x_0: array_like(float, ndim=1)

The initial condtion. A conformable array (of length n, or with n rows)

Returns:

q0: scalar(float)

Represents the value q(x_0)

Remarks: The formula for computing q(x_0) is q(x_0) = x_0’ Q x_0 + v

where

Q is the solution to Q = H + beta A’ Q A and v = trace(C’ Q C) beta / (1 - beta)