# matrix_eqn¶

quantecon.matrix_eqn.solve_discrete_lyapunov(A, B, max_it=50, method='doubling')[source]

Computes the solution to the discrete lyapunov equation

$AXA' - X + B = 0$

$$X$$ is computed by using a doubling algorithm. In particular, we iterate to convergence on $$X_j$$ with the following recursions for $$j = 1, 2, \dots$$ starting from $$X_0 = B$$, $$a_0 = A$$:

$a_j = a_{j-1} a_{j-1}$
$X_j = X_{j-1} + a_{j-1} X_{j-1} a_{j-1}'$
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

methodstring, optional(default=”doubling”)

Describes the solution method to use. If it is “doubling” then uses the doubling algorithm to solve, if it is “bartels-stewart” then it uses scipy’s implementation of the Bartels-Stewart approach.

Returns:
gamma1: array_like(float, ndim=2)

Represents the value $$X$$

quantecon.matrix_eqn.solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500, method='doubling')[source]

Solves the discrete-time algebraic Riccati equation

$X = A'XA - (N + B'XA)'(B'XB + R)^{-1}(N + B'XA) + Q$

Computation is via a modified structured doubling algorithm, an explanation of which can be found in the reference below, if method=”doubling” (default), and via a QZ decomposition method by calling scipy.linalg.solve_discrete_are if method=”qz”.

Parameters:
Aarray_like(float, ndim=2)

k x k array.

Barray_like(float, ndim=2)

k x n array

Qarray_like(float, ndim=2)

k x k, should be symmetric and non-negative definite

Rarray_like(float, ndim=2)

n x n, should be symmetric and positive definite

Narray_like(float, ndim=2)

n x k array

tolerancescalar(float), optional(default=1e-10)

The tolerance level for convergence

max_iterscalar(int), optional(default=500)

The maximum number of iterations allowed

methodstring, optional(default=”doubling”)

Describes the solution method to use. If it is “doubling” then uses the doubling algorithm to solve, if it is “qz” then it uses scipy.linalg.solve_discrete_are (in which case tolerance and max_iter are irrelevant).

Returns:
Xarray_like(float, ndim=2)

The fixed point of the Riccati equation; a k x k array representing the approximate solution

References

Chiang, Chun-Yueh, Hung-Yuan Fan, and Wen-Wei Lin. “STRUCTURED DOUBLING ALGORITHM FOR DISCRETE-TIME ALGEBRAIC RICCATI EQUATIONS WITH SINGULAR CONTROL WEIGHTING MATRICES.” Taiwanese Journal of Mathematics 14, no. 3A (2010): pp-935.

quantecon.matrix_eqn.solve_discrete_riccati_system(Π, As, Bs, Cs, Qs, Rs, Ns, beta, tolerance=1e-10, max_iter=1000)[source]

Solves the stacked system of algebraic matrix Riccati equations in the Markov Jump linear quadratic control problems, by iterating Ps matrices until convergence.

Parameters:
Πarray_like(float, ndim=2)

The Markov chain transition matrix with dimension m x m.

Asarray_like(float)

Consists of m state transition matrices A(s) with dimension n x n for each Markov state s

Bsarray_like(float)

Consists of m state transition matrices B(s) with dimension n x k for each Markov state s

Csarray_like(float), optional(default=None)

Consists of m state transition matrices C(s) with dimension n x j for each Markov state s. If the model is deterministic then Cs should take default value of None

Qsarray_like(float)

Consists of m symmetric and non-negative definite payoff matrices Q(s) with dimension k x k that corresponds with the control variable u for each Markov state s

Rsarray_like(float)

Consists of m symmetric and non-negative definite payoff matrices R(s) with dimension n x n that corresponds with the state variable x for each Markov state s

Nsarray_like(float), optional(default=None)

Consists of m cross product term matrices N(s) with dimension k x n for each Markov state,

betascalar(float), optional(default=1)

beta is the discount parameter

tolerancescalar(float), optional(default=1e-10)

The tolerance level for convergence

max_iterscalar(int), optional(default=500)

The maximum number of iterations allowed

Returns:
Psarray_like(float, ndim=2)

The fixed point of the stacked system of algebraic matrix Riccati equations, consists of m n x n P(s) matrices