Algebraic Lyapunov equation A*X+X*t(A)+Q=0

lyap(A, Q)

Arguments

A

A quadratic matrix without eigenvalues on the imaginary axis

Q

A symmetric matix of same dimension as A

Value

X A symmetric matrix of same dimension as A

Details

If A is asymptotically stable, Q is positive semidefinite and the pair (A,Q) is controllable, then X will be positive definite. Several similar results exist. The implementation uses vectorization and kronecker products and does not employ sparsity, so is only suitable for small systems.

Examples

# A scalar example
(lyap(-1,1))
#>      [,1]
#> [1,]  0.5
# A harmonic oscillator
(lyap(array(c(0,-1,1,-0.1),c(2,2)),diag(c(0,1))))
#>      [,1] [,2]
#> [1,]    5    0
#> [2,]    0    5