
\section{AN APPLICATION OF A GR\"OBNER BASIS}
%\noindent {\bf \S 4. An application of a Gr\"obner bases}

 In $H^\infty$ control one deals with a Hamiltonian $H$ on the
state space $(x,z)$ of the closed loop system.
Here $x$ is a state of the plant and $z$ is a
state of the compensator. The unknowns in $H$ are a quadratic form
$\varepsilon$ which is to be a storage function 
of the closed loop system and the $a,b,c,d$ of 
the unknown compensator. As usual take $d=0$.
If a solution $\varepsilon$ exists 
one can derive
that some controller, called the
central controller, $a,b,c$ 
must be given by certain formulas. 
These formulas do not imply that a solution to the $H^{\infty}$
control problem exist and to see if it does one must plug the
central controller formulas back into $H$ and see if $H\le 0$
for all states $(x,z)$
of the closed loop system. Let's see how this computation 
goes with the methods of  section 3.

{\tiny{
\begin{verbatim}

H= tp[x] ** X ** A ** z + tp[x] ** inv[Y] ** A ** x - 
   tp[x] ** inv[Y] ** A ** z + tp[x] ** tp[A] ** X ** z + 
   tp[x] ** tp[A] ** inv[Y] ** x - tp[x] ** tp[A] ** inv[Y] ** z + 
   tp[x] ** tp[C1] ** C1 ** x + tp[z] ** X ** A ** x - 
   tp[z] ** X ** A ** z - tp[z] ** inv[Y] ** A ** x + 
   tp[z] ** inv[Y] ** A ** z + tp[z] ** tp[A] ** X ** x - 
   tp[z] ** tp[A] ** X ** z - tp[z] ** tp[A] ** inv[Y] ** x + 
   tp[z] ** tp[A] ** inv[Y] ** z + tp[x] ** X ** B1 ** tp[B1] ** X ** z - 
   tp[x] ** X ** B2 ** tp[B2] ** X ** z + 
   tp[x] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** x - 
   tp[x] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** z + 
   tp[z] ** X ** B1 ** tp[B1] ** X ** x - 
   tp[z] ** X ** B1 ** tp[B1] ** X ** z - 
   tp[z] ** X ** B2 ** tp[B2] ** X ** x + 
   tp[z] ** X ** B2 ** tp[B2] ** X ** z - 
   tp[z] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** x + 
   tp[z] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** z - 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** x + 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** z + 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** x - 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** z - 
   tp[x] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** X ** x + 
   tp[x] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** X ** z + 
   tp[x] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** inv[Y] ** x - 
   tp[x] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** inv[Y] ** z + 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** x - 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** z - 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** x + 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** z + 
   tp[z] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** X ** x - 
   tp[z] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** X ** z - 
   tp[z] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** inv[Y] ** x + 
   tp[z] ** tp[C2] ** C2 ** Y ** inv[-1 + X ** Y] ** inv[Y] ** z + 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** x - 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** z - 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** x + 
   tp[x] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** z - 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** x + 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** z + 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** x - 
   tp[x] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** z - 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** x + 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** z + 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** x - 
   tp[z] ** X ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** z + 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** x - 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** X ** z - 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** x + 
   tp[z] ** inv[Y] ** inv[-1 + Y ** X] ** Y ** tp[C2] ** C2 ** Y ** 
    inv[-1 + X ** Y] ** inv[Y] ** z

\end{verbatim}
}}

%\baselineskip=18pt 

Here,
with the usual normalization,
$$
\varepsilon(x,z)= 
\pmatrix{ x^T z^T}
\pmatrix{
Y^{-1} & -(Y^{-1}-X) \cr
-(Y^{-1}-X) & Y^{-1}-X
}
\pmatrix{x \cr z}
\leqno{(4.1)}
$$
and we have taken relations called the 
Doyle Glover Kargonekar Francis simplifying 
assumptions which greatly 
reduce the complexity of the formulas.

Here we have used the same notation that 
one finds in our NCAlgebra program to give a feel for 
how this type of computer 
algebra goes.
{\it tp} stands for transpose while {\it inv}
stands for inverse and `**' for multiply.
%and {\it XX}, {\it YY}, {\it YYI} stand for X, Y, YYI
%respectively. 
%{\bf change to X? and Y?? YES DO IT}

The rules (RESOL) together with (EB) are stored in a 
function NCSimplifyRational in NCAlgebra which applies them 
repeatedly to an expression until no change occurs. We get the considerably simpler expression.

{\tiny{
\begin{verbatim}
HYYI = NCSimplifyRational[H]=
  tp[x] ** X ** A ** z + tp[x] ** inv[Y] ** A ** x - 
   tp[x] ** inv[Y] ** A ** z + tp[x] ** tp[A] ** X ** z + 
   tp[x] ** tp[A] ** inv[Y] ** x - tp[x] ** tp[A] ** inv[Y] ** z + 
   tp[x] ** tp[C1] ** C1 ** x - tp[x] ** tp[C2] ** C2 ** x + 
   tp[x] ** tp[C2] ** C2 ** z + tp[z] ** X ** A ** x - 
   tp[z] ** X ** A ** z - tp[z] ** inv[Y] ** A ** x + 
   tp[z] ** inv[Y] ** A ** z + tp[z] ** tp[A] ** X ** x - 
   tp[z] ** tp[A] ** X ** z - tp[z] ** tp[A] ** inv[Y] ** x + 
   tp[z] ** tp[A] ** inv[Y] ** z + tp[z] ** tp[C2] ** C2 ** x - 
   tp[z] ** tp[C2] ** C2 ** z + tp[x] ** X ** B1 ** tp[B1] ** X ** z - 
   tp[x] ** X ** B2 ** tp[B2] ** X ** z + 
   tp[x] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** x - 
   tp[x] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** z + 
   tp[z] ** X ** B1 ** tp[B1] ** X ** x - 
   tp[z] ** X ** B1 ** tp[B1] ** X ** z - 
   tp[z] ** X ** B2 ** tp[B2] ** X ** x + 
   tp[z] ** X ** B2 ** tp[B2] ** X ** z - 
   tp[z] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** x + 
   tp[z] ** inv[Y] ** B1 ** tp[B1] ** inv[Y] ** z
\end{verbatim}
}
}

Notice that everything of the form inv[1-Y**X] and
inv[1-X**Y] have been eliminated from H.
This took 
27 seconds
on a SPARC II.
In general we have found NCSR very effective in simplifying expressions with inverses of (very simple) polynomials.

This is still a bad expression, but we have not yet used 
the fact that
X and Y solve the two famous {\bf [DGKF]} Ricatti equations
$DGKFX = 0$ and $DGKFYI = 0$ where

$$
DGKFX = X A + A^T X + C_1^T C_1 + 
X  B_1 B_1^T X - X B_2 B_2^T X
$$
$$
DGKFYI = Y^{-1} A + A^T Y^{-1} + C_1^T C_1 - 
C_2^T C_2 + Y^{-1} B_1 B_1^T Y^{-1} .
$$
Actually this is the Ricatti for $Y^{-1}$.
$Y^{-1}$ is denoted YI in NCAlgebra. 
%All we have used is a general purpose simplifier.

Now we show the effect of our simplification methods.
First set an ordering on the indeterminants in these
expressions.
Say 
$ A <  B_1 < B_2 < C_1 < C_2 < x < X < Y^{-1} < 
z < A^T < B_1^T < B_2^T < C_1^T < C_2^T < x^T < z^T$.
This is done in NCAlgebra using the command
$$
SetMonomialOrder[\{A,B1,B2,C1,C2,x,X,YI,
$$
$$
z,tp[A],tp[B1],tp[B2],tp[C1],tp[C2],tp[x],tp[z]\}] \, .
$$

Now we invoke the NCAlgebra command
$$
GroebnerSimplify[HYYI,\{DGKFX,DGKFYI\}] \, .
$$
This command finds a Gr\"obner basis for the ideal
generated by $DGKFX$ and $DGKFYI$ and reduces $HYYI$
by that Gr\"obner basis. The command took 116 seconds
and reduced $HYI$ to 0. 

This completes the core of the sufficient 
side of the famous {\bf [DGKF]} theorem. Namely, that the central
controller has desired $H^{\infty}$ performance level.
It was done automatically with generic methods.

Note in this example we computed a finite 
GB for  a collection of symbols (matrices)
satisfying two Ricatti equations and for a particular order.
The order was chosen by default in the middle
of a computer session. Since it worked, we did not explore
other orders.


%-----------------------------??
%Remark on doing in with oneGB simplify command??
%-----------------------------


Incidently, the Gr\"obner basis was the following
four relations:

\small{
$$ 
-{ X} A - A^T { X} - { C_{1}}^T { C_{1}} - 
  { X} { B_{1}} { B_{1}}^T { X} + 
  { X} { B_{2}} { B_{2}}^T { X}
$$ 
\smallskip
$$ 
{ Y^{-1}} A + A^T { Y^{-1}} + { C_{1}}^T { C_{1}} - { C_{2}}^T { C_{2}} + 
  { Y^{-1}} { B_{1}} { B_{1}}^T { Y^{-1}}
$$ 
\smallskip
\begin{eqnarray*}
&-{ X} A A + A^T A^T { X} + A^T { C_{1}}^T { C_{1}} - 
  { C_{1}}^T { C_{1}} A  \\
&- { X} A { B_{1}} { B_{1}}^T { X} + 
  { X} A { B_{2}} { B_{2}}^T { X} + \\
&  { X} { B_{1}} { B_{1}}^T A^T { X} + 
  { X} { B_{1}} { B_{1}}^T { C_{1}}^T { C_{1}} \\
&- { X} { B_{2}} { B_{2}}^T A^T { X} - 
  { X} { B_{2}} { B_{2}}^T { C_{1}}^T { C_{1}} -  \\
& { C_{1}}^T { C_{1}} { B_{1}} { B_{1}}^T { X} + 
  { C_{1}}^T { C_{1}} { B_{2}} { B_{2}}^T { X}
\end{eqnarray*}
\smallskip
\begin{eqnarray*}
& -{ Y^{-1}} A A + A^T A^T { Y^{-1}} + A^T { C_{1}}^T { C_{1}} - \\
& A^T { C_{2}}^T { C_{2}} - { C_{1}}^T { C_{1}} A + { C_{2}}^T { C_{2}} A \\
&- { Y^{-1}} A { B_{1}} { B_{1}}^T { Y^{-1}} + \\
&  { Y^{-1}} { B_{1}} { B_{1}}^T A^T { Y^{-1}} + 
  { Y^{-1}} { B_{1}} { B_{1}}^T { C_{1}}^T { C_{1}} \\
&- { Y^{-1}} { B_{1}} { B_{1}}^T { C_{2}}^T { C_{2}} - 
  { C_{1}}^T { C_{1}} { B_{1}} { B_{1}}^T { Y^{-1}} + \\
&  { C_{2}}^T { C_{2}} { B_{1}} { B_{1}}^T { Y^{-1}}
\end{eqnarray*}
}
