Re: Lyapunov Equation
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg729] Re: Lyapunov Equation
- From: rubin at msu.edu (Paul A. Rubin)
- Date: 11 Apr 1995 21:28:58 GMT
- Organization: Michigan State University
In article <3md5uo$9fp at news0.cybernetics.net>,
ggb at bigdog.engr.arizona.edu (Gene Bergmeier) wrote:
->Pardon the silly question, but my roommate and I are just beginning to
->use Mathematica. We are attempting to solve the Lyapunov equation (from
->nonlinear controls). The equation is
->
-> PA+Trans(A)P=-Q where
->
-> Q=I
-> P is symmetric
-> and A is general.
->
->We have tried the following procedure. Set Q equal to a 2D identity
->matrix, P as a matrix of p11, p12 and p22 and A as a matrix of known
->coefficients. Then we stated the Lyapunov eq and asked Mathematica to
->solve it for p11, p12 and p22.
->
->Any thoughts or suggestions?
->
->Thanks for the help.
->
->Gene :)
->
->---------------------------------------------------------------------
->Gene Bergmeier
->ggb at bigdog.engr.arizona.edu
->---------------------------------------------------------------------
That works (assuming that you remember to use Dot (.) for the matrix
multiplications and Equal (==) for the equation):
In[1]:= p = {{p11, p12}, {p12, p22}};
In[2]:= q = IdentityMatrix[ 2 ];
In[3]:= a = Table[ 2 Random[] - .5, {i, 2}, {j, 2} ]
Out[3]= {{-0.243847, 1.20228}, {0.504195, -0.312064}}
In[4]:= p0 =
Flatten[ p /.
Solve[ p . a + Transpose[ a ] . p == q,
Union[ Flatten[ p ] ]
],
1
]
Out[4]= {{-0.302853, 0.845209}, {0.845209, 1.65407}}
In[5]:= p0 . a + Transpose[ a ] . p0 (* checking the answer *)
Out[5]= {{1., 0.}, {0., 1.}}
Paul
**************************************************************************
* Paul A. Rubin Phone: (517) 432-3509 *
* Department of Management Fax: (517) 432-1111 *
* Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU *
* Michigan State University *
* East Lansing, MI 48824-1122 (USA) *
**************************************************************************
Mathematicians are like Frenchmen: whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different. J. W. v. GOETHE