
Page 11-53
Function QXA
Function QXA takes as arguments a quadratic form in stack level 2 and a
vector of variables in stack level 1, returning the square matrix
A
from which
the quadratic form is derived in stack level 2, and the list of variables in stack
level 1. For example,
'X^2+Y^2-Z^2+4*X*Y-16*X*Z'
`
['X','Y','Z']
`
QXA
returns
2: [[1 2 –8][2 1 0][-8 0 –1]]
1: [‘X’ ‘Y’ ‘Z’]
Diagonal representation of a quadratic form
Given a symmetric square matrix
A
, it is possible to “diagonalize” the matrix
A
by finding an orthogonal matrix
P
such that
P
T
⋅
A
⋅
P
=
D
, where
D
is a
diagonal matrix. If Q =
x
⋅
A
⋅
x
T
is a quadratic form based on
A
, it is possible
to write the quadratic form Q so that it only contains square terms from a
variable
y
, such that
x
=
P
⋅
y
, by using Q =
x
⋅
A
⋅
x
T
= (
P
⋅
y
)
⋅
A
⋅
(
P
⋅
y
)
T
=
y
⋅
(
P
T
⋅
A
⋅
P
)
⋅
y
T
=
y
⋅
D
⋅
y
T
.
Function SYLVESTER
Function SYLVESTER takes as argument a symmetric square matrix
A
and
returns a vector containing the diagonal terms of a diagonal matrix
D
, and a
matrix
P
, so that
P
T
⋅
A
⋅
P
=
D
. For example,
[[2,1,-1],[1,4,2],[-1,2,-1]] SYLVESTER
produces
2: [ 1/2 2/7 -23/7]
1: [[2 1 –1][0 7/2 5/2][0 0 1]]
Function GAUSS
Function GAUSS returns the diagonal representation of a quadratic form Q =
x
⋅
A
⋅
x
T
taking as arguments the quadratic form in stack level 2 and the vector
of variables in stack level 1. The result of this function call is the following:
•
An array of coefficients representing the diagonal terms of
D
(stack
level 4)
•
A matrix
P
such that
A
=
P
T
⋅
D
⋅
P
(stack level 3)
•
The diagonalized quadratic form (stack level 2)