# matrix_eqn¶

This file holds several functions that are used to solve matrix equations. Currently has functionality to solve:

• Lyapunov Equations
• Riccati Equations
TODO: 1. See issue 47 on github repository, should add support for
Sylvester equations 2. Fix warnings from checking conditioning of matrices
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: 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 method : string, 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. 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: A : array_like(float, ndim=2) k x k array. B : array_like(float, ndim=2) k x n array Q : array_like(float, ndim=2) k x k, should be symmetric and non-negative definite R : array_like(float, ndim=2) n x n, should be symmetric and positive definite N : array_like(float, ndim=2) n x k array tolerance : scalar(float), optional(default=1e-10) The tolerance level for convergence max_iter : scalar(int), optional(default=500) The maximum number of iterations allowed method : string, 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). X : array_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. As : array_like(float) Consists of m state transition matrices A(s) with dimension n x n for each Markov state s Bs : array_like(float) Consists of m state transition matrices B(s) with dimension n x k for each Markov state s Cs : array_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 Qs : array_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 Rs : array_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 Ns : array_like(float), optional(default=None) Consists of m cross product term matrices N(s) with dimension k x n for each Markov state, beta : scalar(float), optional(default=1) beta is the discount parameter tolerance : scalar(float), optional(default=1e-10) The tolerance level for convergence max_iter : scalar(int), optional(default=500) The maximum number of iterations allowed Ps : array_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