quadsums

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:
Aarray_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

Barray_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_itscalar(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) = \mathbb{E} \Big[ \sum_{t=0}^{\infty} \beta^t x_t' H x_t \Big]\]

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

Parameters:
Aarray_like(float, ndim=2)

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

Carray_like(float, ndim=2)

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

Harray_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 = \frac{trace(C' Q C) \beta}{(1 - \beta)}\)